diff options
author | andy.boot <bootandy@gmail.com> | 2024-01-10 18:41:51 +0000 |
---|---|---|
committer | andy.boot <bootandy@gmail.com> | 2024-01-29 22:02:13 +0000 |
commit | 44dac2006b6acd89d3ff79de45dc4b2733709f80 (patch) | |
tree | 159f28693dfc3aaccbb7c662d59e22065e825ed1 | |
parent | ac9be7727ff36e1101c5a780a996d3b06a4fd7bf (diff) |
tests: Print to stderr when test fails
-rw-r--r-- | tests/test_exact_output.rs | 6 |
1 files changed, 5 insertions, 1 deletions
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<T: AsRef<OsStr>>(valid_outputs: Vec<String>, 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 |