Rollup merge of #64745 - kennethbgoodin:should-panic-msg, r=varkor
Include message on tests that should panic but do not As per issue #60790 includes a message for tests marked `#[should_panic]` that do not panic as expected. Fixes #60790.
This commit is contained in:
commit
a60ac8ee0b
@ -1546,6 +1546,7 @@ fn calc_result(desc: &TestDesc, task_result: Result<(), Box<dyn Any + Send>>) ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
(&ShouldPanic::Yes, Ok(())) => TrFailedMsg("test did not panic as expected".to_string()),
|
||||||
_ if desc.allow_fail => TrAllowedFail,
|
_ if desc.allow_fail => TrAllowedFail,
|
||||||
_ => TrFailed,
|
_ => TrFailed,
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ use super::*;
|
|||||||
|
|
||||||
use crate::test::{
|
use crate::test::{
|
||||||
filter_tests, parse_opts, run_test, DynTestFn, DynTestName, MetricMap, RunIgnored,
|
filter_tests, parse_opts, run_test, DynTestFn, DynTestName, MetricMap, RunIgnored,
|
||||||
ShouldPanic, StaticTestName, TestDesc, TestDescAndFn, TestOpts, TrFailed, TrFailedMsg,
|
ShouldPanic, StaticTestName, TestDesc, TestDescAndFn, TestOpts, TrFailedMsg,
|
||||||
TrIgnored, TrOk,
|
TrIgnored, TrOk,
|
||||||
};
|
};
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
@ -167,7 +167,7 @@ fn test_should_panic_but_succeeds() {
|
|||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
run_test(&TestOpts::new(), false, desc, tx, Concurrent::No);
|
run_test(&TestOpts::new(), false, desc, tx, Concurrent::No);
|
||||||
let (_, res, _, _) = rx.recv().unwrap();
|
let (_, res, _, _) = rx.recv().unwrap();
|
||||||
assert!(res == TrFailed);
|
assert!(res == TrFailedMsg("test did not panic as expected".to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
|
fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
|
||||||
|
Loading…
Reference in New Issue
Block a user