Make fake-editor and fake-diff-editor error output more verbose

This commit is contained in:
Ilya Grigoriev 2022-11-22 21:15:20 -08:00
parent 2150166652
commit f4b175a86d
2 changed files with 10 additions and 7 deletions

View file

@ -61,8 +61,9 @@ fn main() {
let actual = files_recursively(&args.before);
if actual != expected {
eprintln!(
"unexpected files before: {:?}",
actual.iter().sorted().collect_vec()
"fake-diff-editor: unexpected files before. EXPECTED: {:?} ACTUAL: {:?}",
expected.iter().sorted().collect_vec(),
actual.iter().sorted().collect_vec(),
);
exit(1)
}
@ -72,8 +73,9 @@ fn main() {
let actual = files_recursively(&args.after);
if actual != expected {
eprintln!(
"unexpected files after: {:?}",
actual.iter().sorted().collect_vec()
"fake-diff-editor: unexpected files after. EXPECTED: {:?} ACTUAL: {:?}",
expected.iter().sorted().collect_vec(),
actual.iter().sorted().collect_vec(),
);
exit(1)
}
@ -92,7 +94,7 @@ fn main() {
std::fs::write(args.after.join(file), payload).unwrap();
}
_ => {
eprintln!("unexpected command: {}", command);
eprintln!("fake-diff-editor: unexpected command: {}", command);
exit(1)
}
}

View file

@ -48,7 +48,8 @@ fn main() {
["expect"] => {
let actual = String::from_utf8(std::fs::read(&args.file).unwrap()).unwrap();
if actual != payload {
eprintln!("unexpected content: {}", actual);
eprintln!("fake-editor: Unexpected content.\n");
eprintln!("EXPECTED: {payload}\nRECEIVED: {actual}");
exit(1)
}
}
@ -56,7 +57,7 @@ fn main() {
std::fs::write(&args.file, payload).unwrap();
}
_ => {
eprintln!("unexpected command: {}", command);
eprintln!("fake-editor: unexpected command: {}", command);
exit(1)
}
}