diff options
Diffstat (limited to 'vendor/toml_edit/tests/invalid.rs')
-rw-r--r-- | vendor/toml_edit/tests/invalid.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/toml_edit/tests/invalid.rs b/vendor/toml_edit/tests/invalid.rs new file mode 100644 index 0000000..9fff235 --- /dev/null +++ b/vendor/toml_edit/tests/invalid.rs @@ -0,0 +1,26 @@ +use toml_edit::Document; + +fn main() { + let args = libtest_mimic::Arguments::from_args(); + let tests = toml_test_data::invalid() + .map(|case| { + libtest_mimic::Trial::test(case.name.display().to_string(), || { + let expect_path = + std::path::Path::new("tests/fixtures").join(case.name.with_extension("stderr")); + let err = match run_case(case.fixture) { + Ok(()) => "".to_owned(), + Err(err) => err, + }; + snapbox::assert_eq_path(expect_path, err); + Ok(()) + }) + }) + .collect(); + libtest_mimic::run(&args, tests).exit() +} + +fn run_case(input: &[u8]) -> Result<(), String> { + let raw = std::str::from_utf8(input).map_err(|e| e.to_string())?; + let _ = raw.parse::<Document>().map_err(|e| e.to_string())?; + Ok(()) +} |