Skip to content

Commit 333644a

Browse files
author
chansuke
committed
Show error message if panic doesn't occur in should_panic
1 parent 605ea9d commit 333644a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libtest/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,7 @@ fn __rust_begin_short_backtrace<F: FnOnce()>(f: F) {
15231523
fn calc_result(desc: &TestDesc, task_result: Result<(), Box<dyn Any + Send>>) -> TestResult {
15241524
match (&desc.should_panic, task_result) {
15251525
(&ShouldPanic::No, Ok(())) | (&ShouldPanic::Yes, Err(_)) => TrOk,
1526+
(&ShouldPanic::Yes, Ok(())) => TrFailedMsg("test did not panic as expected".to_string()),
15261527
(&ShouldPanic::YesWithMessage(msg), Err(ref err)) => {
15271528
if err
15281529
.downcast_ref::<String>()
@@ -1561,6 +1562,7 @@ impl MetricMap {
15611562
///
15621563
/// If `noise` is positive, then it means this metric is of a value
15631564
/// you want to see grow smaller, so a change larger than `noise` in the
1565+
15641566
/// positive direction represents a regression.
15651567
///
15661568
/// If `noise` is negative, then it means this metric is of a value

0 commit comments

Comments
 (0)