(#[files("tests/interpreter_error_inputs/*")] case: PathBuf)
| 22 | /// respective filenames. |
| 23 | #[rstest] |
| 24 | fn ensure_errors_v1(#[files("tests/interpreter_error_inputs/*")] case: PathBuf) -> TestResult { |
| 25 | // Read the input file and parse it. |
| 26 | |
| 27 | use alpm_common::MetadataFile; |
| 28 | use alpm_mtree::Mtree; |
| 29 | let input = read_to_string(&case)?; |
| 30 | let result = Mtree::from_file_with_schema( |
| 31 | &case, |
| 32 | Some(alpm_mtree::MtreeSchema::V1(SchemaVersion::new( |
| 33 | Version::new(1, 0, 0), |
| 34 | ))), |
| 35 | ); |
| 36 | |
| 37 | let Err(error) = result else { |
| 38 | panic!("The interpreter succeeded even though it should've failed for input:\n{input}"); |
| 39 | }; |
| 40 | |
| 41 | let name = case.file_stem().unwrap().to_str().unwrap(); |
| 42 | |
| 43 | // Run the tests with the input being displayed as the description. |
| 44 | // This makes reviewing this whole stuff a lot easier. |
| 45 | // Also remove the usual module prefix, as we're already manually sorting snapshots by test |
| 46 | // scenario. |
| 47 | let input_clone = input.clone(); |
| 48 | insta::with_settings!({ |
| 49 | description => input_clone, |
| 50 | snapshot_path => "interpreter_error_snapshots", |
| 51 | prepend_module_to_snapshot => false, |
| 52 | }, { |
| 53 | assert_snapshot!(name, error); |
| 54 | }); |
| 55 | |
| 56 | Ok(()) |
| 57 | } |
nothing calls this directly
no outgoing calls
no test coverage detected