summaryrefslogtreecommitdiffstats
path: root/tests/ui/test-attrs/test-thread-nocapture.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/test-attrs/test-thread-nocapture.rs')
-rw-r--r--tests/ui/test-attrs/test-thread-nocapture.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/ui/test-attrs/test-thread-nocapture.rs b/tests/ui/test-attrs/test-thread-nocapture.rs
new file mode 100644
index 000000000..2b57eb8aa
--- /dev/null
+++ b/tests/ui/test-attrs/test-thread-nocapture.rs
@@ -0,0 +1,33 @@
+// compile-flags: --test
+// run-fail
+// run-flags: --test-threads=1 --nocapture
+// check-run-results
+// exec-env:RUST_BACKTRACE=0
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
+// ignore-emscripten no threads support
+// needs-unwind
+
+#[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!();
+}