From f4b175a86dc04bed7d47991a7ee80559c7fbae0e Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Tue, 22 Nov 2022 21:15:20 -0800 Subject: [PATCH] Make `fake-editor` and `fake-diff-editor` error output more verbose --- testing/fake-diff-editor.rs | 12 +++++++----- testing/fake-editor.rs | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/testing/fake-diff-editor.rs b/testing/fake-diff-editor.rs index 166dcd10c..7c803e575 100644 --- a/testing/fake-diff-editor.rs +++ b/testing/fake-diff-editor.rs @@ -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) } } diff --git a/testing/fake-editor.rs b/testing/fake-editor.rs index 00d7321b6..c60c99f69 100644 --- a/testing/fake-editor.rs +++ b/testing/fake-editor.rs @@ -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) } }