[fine] Test for function return type mismatch
This commit is contained in:
parent
d893002ec2
commit
44bc072b04
4 changed files with 23 additions and 6 deletions
|
|
@ -259,7 +259,6 @@ fn assert_no_errors(tree: &SyntaxTree, lines: &Lines) {
|
|||
);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn assert_eval_ok(tree: &SyntaxTree, lines: &Lines, expected: &str) {
|
||||
let semantics = Semantics::new(tree, lines);
|
||||
|
||||
|
|
@ -284,4 +283,17 @@ fn assert_eval_ok(tree: &SyntaxTree, lines: &Lines, expected: &str) {
|
|||
}
|
||||
}
|
||||
|
||||
fn assert_check_error(tree: &SyntaxTree, lines: &Lines, expected: &str) {
|
||||
let semantics = Semantics::new(tree, lines);
|
||||
check(&semantics);
|
||||
|
||||
let errors = semantics.snapshot_errors();
|
||||
semantic_assert!(
|
||||
&semantics,
|
||||
None,
|
||||
errors.iter().any(|e| e.message == expected),
|
||||
"Unable to find the expected error message '{expected}'"
|
||||
);
|
||||
}
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/generated_tests.rs"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue