(
#[case] config: InputDirConfig,
#[case] expected: PathBuf,
)
| 430 | PathBuf::from(MetadataFileName::Mtree.as_ref()), |
| 431 | )] |
| 432 | fn 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. |
nothing calls this directly
no test coverage detected