MCPcopy Create free account
hub / github.com/archlinux/alpm / ensure_files_parse_errors

Function ensure_files_parse_errors

alpm-db/tests/parse_errors.rs:59–89  ·  view source on GitHub ↗
(
    #[files("tests/parse_errors/files/*.files")] file: PathBuf,
)

Source from the content-addressed store, hash-verified

57/// and the file's contents as description.
58#[rstest]
59fn ensure_files_parse_errors(
60 #[files("tests/parse_errors/files/*.files")] file: PathBuf,
61) -> TestResult {
62 let input = read_to_string(&file)?;
63 let result = DbFiles::from_str_with_schema(
64 &input,
65 Some(alpm_db::files::DbFilesSchema::V1(SchemaVersion::new(
66 Version::new(1, 0, 0),
67 ))),
68 );
69
70 match result {
71 Ok(files) => panic!("Should have failed but created DbFiles:\n{files}"),
72 Err(error) => {
73 let name = file
74 .file_stem()
75 .and_then(|s| s.to_str())
76 .unwrap_or("UNKNOWN FILE");
77
78 insta::with_settings!({
79 description => &input,
80 snapshot_path => "parse_errors/files/snapshots",
81 prepend_module_to_snapshot => false,
82 }, {
83 assert_snapshot!(name, error.to_string());
84 })
85 }
86 }
87
88 Ok(())
89}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected