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

Function package_input_fails_on_missing_metadata

alpm-package/tests/integration.rs:432–457  ·  view source on GitHub ↗
(
    #[case] config: InputDirConfig,
    #[case] expected: PathBuf,
)

Source from the content-addressed store, hash-verified

430 PathBuf::from(MetadataFileName::Mtree.as_ref()),
431)]
432fn package_input_fails_on_missing_metadata(
433 #[case] config: InputDirConfig,
434 #[case] expected: PathBuf,
435) -> TestResult {
436 init_logger();
437
438 // Create a common temporary dir.
439 let temp_dir = TempDir::new()?;
440 let input_dir = InputDir::new(temp_dir.path().to_path_buf())?;
441
442 prepare_input_dir(&input_dir, &config)?;
443
444 if let Err(error) = PackageInput::try_from(input_dir) {
445 match error {
446 alpm_package::Error::Input(alpm_package::input::Error::FileIsMissing {
447 path,
448 input_dir: _,
449 }) => assert_eq!(path, expected),
450 _ => panic!("Did not return the correct error variant"),
451 }
452 } else {
453 panic!("Should have returned an error but succeeded");
454 }
455
456 Ok(())
457}
458
459/// Ensures that [`PackageInput`] has the correct amount of files depending on whether data files
460/// and scriptlet are present.

Callers

nothing calls this directly

Calls 4

init_loggerFunction · 0.70
prepare_input_dirFunction · 0.70
to_path_bufMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected