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

Function test_package_input_methods

alpm-package/tests/integration.rs:471–505  ·  view source on GitHub ↗
(#[case] config: InputDirConfig)

Source from the content-addressed store, hash-verified

469 InputDirConfig { build_info: true, data_files: false, mtree: true, package_info: true, scriptlet: false },
470)]
471fn test_package_input_methods(#[case] config: InputDirConfig) -> TestResult {
472 init_logger();
473
474 // Create a common temporary dir.
475 let temp_dir = TempDir::new()?;
476 let input_dir = InputDir::new(temp_dir.path().to_path_buf())?;
477
478 prepare_input_dir(&input_dir, &config)?;
479 let package_input: PackageInput = input_dir.try_into()?;
480
481 // Ensure that all metadata can be retrieved.
482 let _mtree = package_input.mtree()?;
483 let _build_info = package_input.build_info();
484 let _package_info = package_input.package_info();
485
486 if config.scriptlet {
487 assert!(package_input.install_scriptlet().is_some());
488 if !config.data_files {
489 // Only metadata files and the scriptlet are present
490 assert!(package_input.relative_paths().len() == 4)
491 } else {
492 assert!(package_input.relative_paths().len() > 4)
493 }
494 } else {
495 assert!(package_input.install_scriptlet().is_none());
496 if !config.data_files {
497 // Only metadata files are present
498 assert!(package_input.relative_paths().len() == 3)
499 } else {
500 assert!(package_input.relative_paths().len() > 3)
501 }
502 }
503
504 Ok(())
505}
506
507/// Ensures that [`PackageCreationConfig::new`] fails on overlapping input and output directories.
508///

Callers

nothing calls this directly

Calls 7

mtreeMethod · 0.80
build_infoMethod · 0.80
package_infoMethod · 0.80
init_loggerFunction · 0.70
prepare_input_dirFunction · 0.70
to_path_bufMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected