about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/run-fail/unwind-assert.rs6
-rw-r--r--src/test/run-fail/unwind-check.rs8
-rw-r--r--src/test/run-fail/unwind-closure.rs10
-rw-r--r--src/test/run-fail/unwind-initializer.rs7
-rw-r--r--src/test/run-fail/unwind-iter.rs12
-rw-r--r--src/test/run-fail/unwind-nested.rs11
-rw-r--r--src/test/run-fail/unwind-stacked.rs16
-rw-r--r--src/test/run-fail/unwind-uninitialized.rs10
-rw-r--r--src/test/run-pass/unwind-box.rs13
-rw-r--r--src/test/run-pass/unwind-resource.rs20
-rw-r--r--src/test/run-pass/unwind-resource2.rs17
11 files changed, 130 insertions, 0 deletions
diff --git a/src/test/run-fail/unwind-assert.rs b/src/test/run-fail/unwind-assert.rs
new file mode 100644
index 00000000000..e7aeedcf505
--- /dev/null
+++ b/src/test/run-fail/unwind-assert.rs
@@ -0,0 +1,6 @@
+// error-pattern:fail
+
+fn main() {
+    let a = @0;
+    assert false;
+}
\ No newline at end of file
diff --git a/src/test/run-fail/unwind-check.rs b/src/test/run-fail/unwind-check.rs
new file mode 100644
index 00000000000..e01cc969cea
--- /dev/null
+++ b/src/test/run-fail/unwind-check.rs
@@ -0,0 +1,8 @@
+// error-pattern:fail
+
+pure fn p(a: @int) -> bool { false }
+
+fn main() {
+    let a = @0;
+    check p(a);
+}
\ No newline at end of file
diff --git a/src/test/run-fail/unwind-closure.rs b/src/test/run-fail/unwind-closure.rs
new file mode 100644
index 00000000000..216ae054947
--- /dev/null
+++ b/src/test/run-fail/unwind-closure.rs
@@ -0,0 +1,10 @@
+// error-pattern:fail
+
+fn f(a: @int) {
+    fail;
+}
+
+fn main() {
+    let g = bind f(@0);
+    g();
+}
\ No newline at end of file
diff --git a/src/test/run-fail/unwind-initializer.rs b/src/test/run-fail/unwind-initializer.rs
new file mode 100644
index 00000000000..b3dc0d3eaeb
--- /dev/null
+++ b/src/test/run-fail/unwind-initializer.rs
@@ -0,0 +1,7 @@
+// error-pattern:fail
+
+fn main() {
+    let a: @int = {
+        fail;
+    };
+}
\ No newline at end of file
diff --git a/src/test/run-fail/unwind-iter.rs b/src/test/run-fail/unwind-iter.rs
new file mode 100644
index 00000000000..fa64b0ad78c
--- /dev/null
+++ b/src/test/run-fail/unwind-iter.rs
@@ -0,0 +1,12 @@
+// error-pattern:fail
+
+iter x() -> int {
+    fail;
+    put 0;
+}
+
+fn main() {
+    let a = @0;
+    for each x in x() {
+    }
+}
\ No newline at end of file
diff --git a/src/test/run-fail/unwind-nested.rs b/src/test/run-fail/unwind-nested.rs
new file mode 100644
index 00000000000..48e3063c6dd
--- /dev/null
+++ b/src/test/run-fail/unwind-nested.rs
@@ -0,0 +1,11 @@
+// error-pattern:fail
+
+fn main() {
+    let a = @0;
+    {
+        let b = @0;
+        {
+            fail;
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/run-fail/unwind-stacked.rs b/src/test/run-fail/unwind-stacked.rs
new file mode 100644
index 00000000000..bf5258cee7d
--- /dev/null
+++ b/src/test/run-fail/unwind-stacked.rs
@@ -0,0 +1,16 @@
+// error-pattern:fail
+
+fn f() {
+    let a = @0;
+    fail;
+}
+
+fn g() {
+    let b = @0;
+    f();
+}
+
+fn main() {
+    let a = @0;
+    g();
+}
\ No newline at end of file
diff --git a/src/test/run-fail/unwind-uninitialized.rs b/src/test/run-fail/unwind-uninitialized.rs
new file mode 100644
index 00000000000..35269b38714
--- /dev/null
+++ b/src/test/run-fail/unwind-uninitialized.rs
@@ -0,0 +1,10 @@
+// error-pattern:fail
+
+fn f() {
+    fail;
+}
+
+fn main() {
+    f();
+    let a = @0;
+}
\ No newline at end of file
diff --git a/src/test/run-pass/unwind-box.rs b/src/test/run-pass/unwind-box.rs
new file mode 100644
index 00000000000..692a62c8272
--- /dev/null
+++ b/src/test/run-pass/unwind-box.rs
@@ -0,0 +1,13 @@
+use std;
+import std::task;
+
+fn f() {
+    task::unsupervise();
+    let a = @0;
+    fail;
+}
+
+fn main() {
+    let g = f;
+    task::spawn(g);
+}
\ No newline at end of file
diff --git a/src/test/run-pass/unwind-resource.rs b/src/test/run-pass/unwind-resource.rs
new file mode 100644
index 00000000000..cd25e43dfce
--- /dev/null
+++ b/src/test/run-pass/unwind-resource.rs
@@ -0,0 +1,20 @@
+use std;
+import std::task;
+import std::comm;
+
+resource complainer(c: comm::chan<bool>) {
+    comm::send(c, true);
+}
+
+fn f(c: -comm::chan<bool>) {
+    task::unsupervise();
+    let c <- complainer(c);
+    fail;
+}
+
+fn main() {
+    let p = comm::port();
+    let c = comm::chan(p);
+    task::spawn(bind f(c));
+    assert comm::recv(p);
+}
\ No newline at end of file
diff --git a/src/test/run-pass/unwind-resource2.rs b/src/test/run-pass/unwind-resource2.rs
new file mode 100644
index 00000000000..d2797f5154a
--- /dev/null
+++ b/src/test/run-pass/unwind-resource2.rs
@@ -0,0 +1,17 @@
+use std;
+import std::task;
+import std::comm;
+
+resource complainer(c: @int) {
+}
+
+fn f() {
+    task::unsupervise();
+    let c <- complainer(@0);
+    fail;
+}
+
+fn main() {
+    let g = f;
+    task::spawn(g);
+}
\ No newline at end of file