ok/jj
1
0
Fork 0
forked from mirrors/jj

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

View file

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