use super::*;
#[test]
fn classify_reports_already_owned_for_a_path_the_ownership_record_lists() {
let dir = tempfile::tempdir().expect("tempdir");
let base = dir.path();
let relative = Path::new("generated/config.m4");
let full = base.join(relative);
let existing = "dnl old\n";
let generated = "dnl new\n";
seed(base, relative.to_str().expect("utf8 path"), existing);
let before = super::classify(base, &full, relative, generated, existing, false);
assert_eq!(
before.state,
super::AdoptionState::Drifted,
"negative control: an unrecorded, unmarkable path with genuinely different content \
must not be reported already owned -- otherwise this test cannot prove the record \
is what flips the verdict below"
);
crate::cli::cache::record_scaffold_owned_path(base, &full).expect("record ownership");
let after = super::classify(base, &full, relative, generated, existing, false);
assert_eq!(
after.state,
super::AdoptionState::AlreadyOwned,
"a path the committed ownership record already lists must never be re-offered for \
adoption -- the write guard (`is_owned_by_ownership_record`) already accepts it"
);
}