use conserve::test_fixtures::{ScratchArchive, TreeFixture};
use conserve::*;
#[test]
fn diff_unchanged() {
let a = ScratchArchive::new();
let tf = TreeFixture::new();
tf.create_file_with_contents("thing", b"contents of thing");
let lt = tf.live_tree();
let stats = backup(&a, <, &BackupOptions::default()).unwrap();
assert_eq!(stats.new_files, 1);
let st = a.open_stored_tree(BandSelectionPolicy::Latest).unwrap();
let options = DiffOptions {
include_unchanged: true,
..DiffOptions::default()
};
let des: Vec<DiffEntry> = diff(&st, <, &options).unwrap().collect();
assert_eq!(des.len(), 2); assert_eq!(
des[0],
DiffEntry {
apath: "/".into(),
kind: DiffKind::Unchanged,
}
);
assert_eq!(
des[1],
DiffEntry {
apath: "/thing".into(),
kind: DiffKind::Unchanged,
}
);
let options = DiffOptions {
include_unchanged: false,
..DiffOptions::default()
};
assert_eq!(diff(&st, <, &options).unwrap().count(), 0);
}