monochromatic-git-policy-cli 0.1.2

Repository-owned Git policy wrapper: forwards Git commands and checks commits against configured policies.
Documentation
//! Controls for the pure parts of a landing attempt.
//! The attempt itself runs against real repositories, in `binary_landing_tests.rs`.

use super::*;

/// Only a target that names a commit can be replayed onto.
#[test]
fn only_a_commit_target_names_a_commit() {
    assert!(names_commit(&Base::Commit("a".repeat(40))));
    assert!(!names_commit(&Base::Unborn));
}

/// Each failing step is worded by its own cause, with the text it carries.
#[test]
fn each_failure_is_worded_by_its_cause() {
    assert_eq!(LandingError::Git(GitFailure(String::from("git broke"))).to_string(), "git broke");
    assert_eq!(LandingError::Recovery(RecoveryError(String::from("recovery broke"))).to_string(), "recovery broke");
    assert_eq!(LandingError::Journal(String::from("journal broke")).to_string(), "journal broke");
    assert_eq!(LandingError::Release(String::from("release broke")).to_string(), "release broke");
    assert_eq!(
        LandingError::Phase(PhaseMarkerError::Io(std::io::Error::other("disk"))).to_string(),
        "transaction phase marker failed: disk"
    );
    assert!(
        LandingError::Lock(CoordinationFailure::Stop(String::from("lock broke")))
            .to_string()
            .contains("lock broke")
    );
}