-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
#[should_panic(expected = ...)] non-functional. #5054
Copy link
Copy link
Closed
Labels
A-DiagnosticsLogging, crash handling, error reporting and performance analysisLogging, crash handling, error reporting and performance analysisA-TasksTools for parallel and async workTools for parallel and async workC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior
Description
Bevy version
Release 0.7
What you did
Repeatedly run the following minimum code sample with cargo test
use bevy::prelude::*;
#[test]
#[should_panic(expected = "expected panic")]
fn mvs_test() {
App::new()
.add_plugins(MinimalPlugins)
.add_system( || {
panic!("expected panic");
})
.run();
}About 9/10 times the result is as expected
Finished test [unoptimized + debuginfo] target(s) in 0.18s
Running unittests src/main.rs (target/debug/deps/temp_test-698e95098388382a)
running 1 test
test mvs_test - should panic ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00sWhat went wrong
About 1/10 times the test fails, with the message
Finished test [unoptimized + debuginfo] target(s) in 0.18s
Running unittests src/main.rs (target/debug/deps/temp_test-698e95098388382a)
running 1 test
test mvs_test - should panic ... FAILED
failures:
---- const_change_test stdout ----
thread 'Compute Task Pool (2)' panicked at 'expected panic', src/main.rs:9:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'mvs_test' panicked at 'task has failed', /Users/fraser/.cargo/registry/src/github.com-1ecc6299db9ec823/async-task-4.2.0/src/task.rs:425:45
note: panic did not contain expected string
panic message: `"task has failed"`,
expected substring: `"expected panic"`
failures:
mvs_test
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
error: test failed, to rerun pass '--bin temp_test'The correct panic is triggered, but the wrong panic message is sent.
Additional information
I've tried both running tests with cargo test -- --test-threads=1, and using the serial_test crate - neither helping.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-DiagnosticsLogging, crash handling, error reporting and performance analysisLogging, crash handling, error reporting and performance analysisA-TasksTools for parallel and async workTools for parallel and async workC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior