From 96068518f603eed59d9dcb17fad60676a8f3fba7 Mon Sep 17 00:00:00 2001 From: "andy.boot" Date: Wed, 10 Jan 2024 18:41:51 +0000 Subject: [PATCH] tests: Print to stderr when test fails --- tests/test_exact_output.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_exact_output.rs b/tests/test_exact_output.rs index 89a5014..1cc06f2 100644 --- a/tests/test_exact_output.rs +++ b/tests/test_exact_output.rs @@ -52,7 +52,11 @@ fn exact_output_test>(valid_outputs: Vec, command_args: let output = str::from_utf8(&a.unwrap().stdout).unwrap().to_owned(); - assert!(valid_outputs.iter().any(|i| output.contains(i))); + let will_fail = valid_outputs.iter().any(|i| output.contains(i)); + if !will_fail { + eprintln!("output:\n{}\ndoes not contain any of:\n{:?}",output, valid_outputs.iter()); + } + assert!(will_fail) } // "windows" result data can vary by host (size seems to be variable by one byte); fix code vs test and re-enable