about summary refs log tree commit diff
path: root/src/test/stdtest/vec.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/stdtest/vec.rs')
-rw-r--r--src/test/stdtest/vec.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/stdtest/vec.rs b/src/test/stdtest/vec.rs
index 453c9f8e414..5f644c450b6 100644
--- a/src/test/stdtest/vec.rs
+++ b/src/test/stdtest/vec.rs
@@ -5,6 +5,7 @@ import std::vec::*;
 import std::option;
 import std::option::none;
 import std::option::some;
+import std::task;
 
 fn square(n: uint) -> uint { ret n * n; }
 
@@ -443,6 +444,31 @@ fn reversed_mut() {
     assert (v2[1] == 10);
 }
 
+#[test]
+fn init() {
+    let v = vec::init([1, 2, 3]);
+    assert v == [1, 2];
+}
+
+#[cfg(target_os = "linux")]
+#[cfg(target_os = "mac")]
+#[test]
+fn init_empty() {
+
+    let r = task::join(
+        task::spawn_joinable((), fn (&&_i: ()) {
+            task::unsupervise();
+            vec::init::<int>([]);
+        }));
+    assert r == task::tr_failure
+}
+
+// FIXME: Windows can't undwind
+#[cfg(target_os = "win32")]
+#[test]
+#[ignore]
+fn init_empty() { }
+
 // Local Variables:
 // mode: rust;
 // fill-column: 78;