test(check): if scoping
This commit is contained in:
parent
d41e6942c6
commit
c4a588f3dd
|
@ -104,6 +104,27 @@ fn validator_in_lib_warning() {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn if_scoping() {
|
||||||
|
let source_code = r#"
|
||||||
|
pub fn foo(c) {
|
||||||
|
if c {
|
||||||
|
let bar = 1
|
||||||
|
bar
|
||||||
|
} else if !c {
|
||||||
|
bar
|
||||||
|
} else {
|
||||||
|
bar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"#;
|
||||||
|
|
||||||
|
assert!(matches!(
|
||||||
|
check_validator(parse(source_code)),
|
||||||
|
Err((_, Error::UnknownVariable { .. }))
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn list_pattern_1() {
|
fn list_pattern_1() {
|
||||||
let source_code = r#"
|
let source_code = r#"
|
||||||
|
|
Loading…
Reference in New Issue