2020-08-04 20:42:36 -05:00
|
|
|
// compile-flags: --test
|
|
|
|
// run-fail
|
|
|
|
// run-flags: --test-threads=1 --nocapture
|
|
|
|
// check-run-results
|
|
|
|
// exec-env:RUST_BACKTRACE=0
|
2020-11-26 14:15:15 -06:00
|
|
|
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
|
2020-10-26 15:36:33 -05:00
|
|
|
// ignore-emscripten no threads support
|
2022-10-13 16:26:52 -05:00
|
|
|
// needs-unwind
|
2020-08-04 20:42:36 -05:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn thready_pass() {
|
|
|
|
println!("fee");
|
|
|
|
std::thread::spawn(|| {
|
|
|
|
println!("fie");
|
|
|
|
println!("foe");
|
|
|
|
})
|
|
|
|
.join()
|
|
|
|
.unwrap();
|
|
|
|
println!("fum");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn thready_fail() {
|
|
|
|
println!("fee");
|
|
|
|
std::thread::spawn(|| {
|
|
|
|
println!("fie");
|
|
|
|
println!("foe");
|
|
|
|
})
|
|
|
|
.join()
|
|
|
|
.unwrap();
|
|
|
|
println!("fum");
|
|
|
|
panic!();
|
|
|
|
}
|