in src/main.rs [1029:1058]
fn test_print_changed_files() {
let dir = TempDir::new("fastmodtest").unwrap();
let mut expected_changed_files = Vec::new();
for file_num in 1..6 {
let path = dir.path().join(format!("file{}.c", file_num));
let mut file = File::create(path.clone()).unwrap();
file.write_all(if file_num % 2 == 0 {
b"foo\n"
} else {
b"bar\n"
})
.unwrap();
file.sync_all().unwrap();
if file_num % 2 == 0 {
expected_changed_files.push(path.as_os_str().to_string_lossy().into_owned());
}
}
Command::cargo_bin("fastmod")
.unwrap()
.args(&[
"foo",
"baz",
"--accept-all",
"--print-changed-files",
"--dir",
dir.path().to_str().unwrap(),
])
.assert()
.stdout(format!("{}\n", expected_changed_files.join("\n")));
}