feat: expect boolean sugar

This commit is contained in:
rvcas
2023-07-15 20:50:02 -04:00
parent d009358266
commit 1b8e94fe32
9 changed files with 198 additions and 31 deletions

View File

@@ -154,6 +154,33 @@ fn multi_validator_warning() {
))
}
#[test]
fn expect_sugar_correct_type() {
let source_code = r#"
fn foo() {
expect 1 == 1
2
}
"#;
assert!(matches!(check(parse(source_code)), Ok(_)))
}
#[test]
fn expect_sugar_incorrect_type() {
let source_code = r#"
fn foo() {
expect 1
2
}
"#;
assert!(matches!(
dbg!(check(parse(source_code))),
Err((_, Error::CouldNotUnify { .. }))
))
}
#[test]
fn anonymous_function_scoping() {
let source_code = r#"