diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/errors.rs | 12 | ||||
-rw-r--r-- | src/tests/mod.rs | 4 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/tests/errors.rs b/src/tests/errors.rs new file mode 100644 index 0000000..abe1bbb --- /dev/null +++ b/src/tests/errors.rs @@ -0,0 +1,12 @@ +use crate::Configuration; + +#[test] +fn parsing() { + super::do_tests_in_dir("errors", ".pom", |filename| { + if Configuration::load_path(filename).is_ok() { + Err(format!("should produce an error, but doesn't").into()) + } else { + Ok(()) + } + }) +} diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 83873dc..97a3a29 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -1,3 +1,4 @@ +mod errors; mod locations; mod parsing; @@ -21,7 +22,8 @@ fn do_tests_in_dir( .expect("bad UTF-8 in test name (file in {test_dir})"); if filename.ends_with(ext) { println!("Running test {dir}/{filename}..."); - test(&format!("{test_dir}/{filename}"))? + test(&format!("{test_dir}/{filename}")) + .map_err(|e| format!("{dir}/{filename}: {e}"))?; } } Ok(()) |