about summary refs log tree commit diff
path: root/src/test/ui/threads-sendsync
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-04-16 15:50:32 +0900
committerYuki Okushi <huyuumi.dev@gmail.com>2020-05-06 14:02:55 +0900
commite69748ba4f48efdc9a1dfcf8c16bc9aba39a86e3 (patch)
tree33fc77d7a08037da5deeb878068f5af0284aa732 /src/test/ui/threads-sendsync
parent43271a39adc26d29350d4830b594c6435472815e (diff)
Move tests from `test/run-fail` to UI
Diffstat (limited to 'src/test/ui/threads-sendsync')
-rw-r--r--src/test/ui/threads-sendsync/task-spawn-barefn.rs18
-rw-r--r--src/test/ui/threads-sendsync/test-tasks-invalid-value.rs11
2 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/threads-sendsync/task-spawn-barefn.rs b/src/test/ui/threads-sendsync/task-spawn-barefn.rs
new file mode 100644
index 00000000000..e5b899e0af9
--- /dev/null
+++ b/src/test/ui/threads-sendsync/task-spawn-barefn.rs
@@ -0,0 +1,18 @@
+// run-fail
+// error-pattern:Ensure that the child thread runs by panicking
+// ignore-emscripten Needs threads.
+
+use std::thread;
+
+fn main() {
+    // the purpose of this test is to make sure that thread::spawn()
+    // works when provided with a bare function:
+    let r = thread::spawn(startfn).join();
+    if r.is_err() {
+        panic!()
+    }
+}
+
+fn startfn() {
+    assert!("Ensure that the child thread runs by panicking".is_empty());
+}
diff --git a/src/test/ui/threads-sendsync/test-tasks-invalid-value.rs b/src/test/ui/threads-sendsync/test-tasks-invalid-value.rs
new file mode 100644
index 00000000000..6411421429c
--- /dev/null
+++ b/src/test/ui/threads-sendsync/test-tasks-invalid-value.rs
@@ -0,0 +1,11 @@
+// This checks that RUST_TEST_THREADS not being 1, 2, ... is detected
+// properly.
+
+// run-fail
+// error-pattern:should be a positive integer
+// compile-flags: --test
+// exec-env:RUST_TEST_THREADS=foo
+// ignore-emscripten
+
+#[test]
+fn do_nothing() {}