-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
Tests without fixtures work as expected with #[should_panic]. However, tests with fixtures don't. Using an expected message as in #[should_panic(expected = "whatever") doesn't work. The test will always fail, even if the panic message was correct. This diff demonstrates the problem
diff --git a/tests/test_suite.rs b/tests/test_suite.rs
index d0ca37e..5d54bd3 100644
--- a/tests/test_suite.rs
+++ b/tests/test_suite.rs
@@ -30,6 +30,11 @@ test_suite! {
test simple_test() {
assert!(true);
}
+
+ #[should_panic(expected = "xxx")]
+ test panic_test() {
+ panic!("xxx");
+ }
}
test_suite! {
@@ -44,6 +49,11 @@ test_suite! {
test inject_fixture(test_fixture) {
assert_eq!(test_fixture.val, 42);
}
+
+ #[should_panic(expected = "xxx")]
+ test panic_test(test_fixture) {
+ panic!("xxx");
+ }
}
test_suite! {