Skip to content

Commit 28867a1

Browse files
committed
Add test of multiple error collection
1 parent 5604c6b commit 28867a1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/parsing/parser.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4459,6 +4459,41 @@ echo test
44594459
);
44604460
}
44614461

4462+
#[test]
4463+
fn test_multiple_error_collection() {
4464+
use std::path::Path;
4465+
4466+
// Create a string with 3 procedures: 2 with errors and 1 valid
4467+
let content = r#"
4468+
broken_proc1 : A ->
4469+
# This procedure has incomplete signature
4470+
4471+
1. Do something
4472+
4473+
valid_proc : A -> B
4474+
# This is a valid procedure
4475+
4476+
1. Valid step
4477+
2. Another valid step
4478+
4479+
broken_proc2 : -> B
4480+
# This procedure has incomplete signature (missing domain)
4481+
4482+
1. Do something else
4483+
"#;
4484+
4485+
let result = parse_with_recovery(Path::new("test.t"), content);
4486+
4487+
// Assert that there are at least 2 errors (from the broken procedures)
4488+
match result {
4489+
Ok(_) => panic!("Result should have errors"),
4490+
Err(errors) => {
4491+
let l = errors.len();
4492+
assert!(l >= 2, "Should have at least 2 errors, got {}", l)
4493+
}
4494+
};
4495+
}
4496+
44624497
#[test]
44634498
fn multiline_code_inline() {
44644499
let mut input = Parser::new();

0 commit comments

Comments
 (0)