test(check): if scoping

This commit is contained in:
rvcas 2023-02-15 23:53:57 -05:00 committed by Lucas
parent d41e6942c6
commit c4a588f3dd
1 changed files with 21 additions and 0 deletions

View File

@ -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]
fn list_pattern_1() {
let source_code = r#"