diff --git a/libtest/lib.rs b/libtest/lib.rs index 2dcc0e3..f8f5284 100644 --- a/libtest/lib.rs +++ b/libtest/lib.rs @@ -305,12 +305,14 @@ pub fn test_main_static(tests: &[&TestDescAndFn]) { /// and checks for a `0` result. pub fn assert_test_result(result: T) { let code = result.report(); - assert_eq!( - code, 0, - "the test returned a termination value with a non-zero status code ({}) \ - which indicates a failure", - code - ); + if code != 0 { + panic!( + "the test returned a termination value with a non-zero status code ({}) \ + which indicates a failure (this most likely means your test returned \ + an `Err(_)` value)", + code, + ); + } } #[derive(Copy, Clone, Debug)]