Skip to main content

select

Function select 

Source
pub fn select(
    root: &Path,
    registry: &CapabilityRegistry,
    objects: &[Object],
) -> Selection
Expand description

Make the release selection (Selection): analyse the contract against the last release, refuse a guess (crate::release::compat::VersionPlan::measured_version), and decide the report from what is left (report).

use majordomus_cli::capability::registry::CapabilityRegistry;
use majordomus_cli::release::version::{default_target, select, Version};
let dir = tempfile::tempdir().unwrap();
let registry = CapabilityRegistry::builder().build().unwrap();
let selection = select(dir.path(), &registry, &[]);
// the writer's default target is read from this report, so it refuses with its reason
let current = Version::parse("0.1.0").unwrap();
assert_eq!(
    default_target(&selection.report, current).unwrap_err(),
    selection.report.contract_unreadable.clone().unwrap()
);