about summary refs log tree commit diff
path: root/src/libstd/task
diff options
context:
space:
mode:
authorFlaper Fesp <flaper87@gmail.com>2013-08-20 01:26:05 +0200
committerFlaper Fesp <flaper87@gmail.com>2013-08-27 00:35:39 +0200
commit5fc4045d789ed752c49b9368a2cc9a1cd8c341d5 (patch)
tree1860876ee4ed3beba8d73845bb0c1598a746ce4b /src/libstd/task
parentc4093b4a83dc1660257c88ca7834c46530010985 (diff)
downloadrust-5fc4045d789ed752c49b9368a2cc9a1cd8c341d5.tar.gz
rust-5fc4045d789ed752c49b9368a2cc9a1cd8c341d5.zip
Don't make the runtime exit on illegal calls
Diffstat (limited to 'src/libstd/task')
-rw-r--r--src/libstd/task/mod.rs48
1 files changed, 33 insertions, 15 deletions
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs
index c66296723b1..d094623b57b 100644
--- a/src/libstd/task/mod.rs
+++ b/src/libstd/task/mod.rs
@@ -671,7 +671,39 @@ fn test_kill_rekillable_task() {
     }
 }
 
-#[test] #[should_fail]
+#[test]
+#[ignore(cfg(windows))]
+#[should_fail]
+fn test_rekillable_not_nested() {
+    do rekillable {
+        // This should fail before
+        // receiving anything since
+        // this block should be nested
+        // into a unkillable block.
+        yield();
+    }
+}
+
+
+#[test]
+#[ignore(cfg(windows))]
+fn test_rekillable_nested_failure() {
+
+    let result = do task::try {
+        do unkillable {
+            do rekillable {
+                let (port,chan) = comm::stream();
+                do task::spawn { chan.send(()); fail!(); }
+                port.recv(); // wait for child to exist
+                port.recv(); // block forever, expect to get killed.
+            } 
+        }
+    };
+    assert!(result.is_err());
+}
+
+
+#[test] #[should_fail] #[ignore(cfg(windows))]
 fn test_cant_dup_task_builder() {
     let mut builder = task();
     builder.unlinked();
@@ -1239,20 +1271,6 @@ fn test_unkillable_nested() {
     po.recv();
 }
 
-#[ignore(reason = "linked failure")]
-#[test]
-#[ignore(cfg(windows))]
-#[should_fail]
-fn test_rekillable_not_nested() {
-    do rekillable {
-        // This should fail before
-        // receiving anything since
-        // this block should be nested
-        // into a unkillable block.
-        yield();
-    }
-}
-
 #[test]
 fn test_child_doesnt_ref_parent() {
     // If the child refcounts the parent task, this will stack overflow when