]> git.lizzy.rs Git - rust.git/blob - src/test/ui/test-attrs/test-thread-capture.rs
:arrow_up: rust-analyzer
[rust.git] / src / test / ui / test-attrs / test-thread-capture.rs
1 // compile-flags: --test
2 // run-fail
3 // run-flags: --test-threads=1
4 // check-run-results
5 // exec-env:RUST_BACKTRACE=0
6 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
7 // ignore-emscripten no threads support
8 // needs-unwind
9
10 #[test]
11 fn thready_pass() {
12     println!("fee");
13     std::thread::spawn(|| {
14         println!("fie");
15         println!("foe");
16     })
17     .join()
18     .unwrap();
19     println!("fum");
20 }
21
22 #[test]
23 fn thready_fail() {
24     println!("fee");
25     std::thread::spawn(|| {
26         println!("fie");
27         println!("foe");
28     })
29     .join()
30     .unwrap();
31     println!("fum");
32     panic!();
33 }