[fine] Assignments!

And new error capabilities!
This commit is contained in:
John Doty 2024-01-19 19:08:17 -08:00
parent 92cf840766
commit f20f5a5e03
12 changed files with 400 additions and 64 deletions

View file

@ -283,6 +283,25 @@ fn assert_eval_ok(tree: &SyntaxTree, lines: &Lines, expected: &str) {
}
}
fn assert_errors(tree: &SyntaxTree, lines: &Lines, expected_errors: Vec<&str>) {
let semantics = Semantics::new(tree, lines);
check(&semantics);
let errors: Vec<String> = semantics
.snapshot_errors()
.iter()
.map(|e| format!("{}", e))
.collect();
semantic_assert_eq!(
&semantics,
None,
expected_errors,
errors,
"expected no errors"
);
}
fn assert_check_error(tree: &SyntaxTree, lines: &Lines, expected: &str) {
let semantics = Semantics::new(tree, lines);
check(&semantics);