about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcore/at_vec.rs16
-rw-r--r--src/libcore/ptr.rs11
-rw-r--r--src/test/run-pass/at_vec_building.rs16
-rw-r--r--src/test/run-pass/ptr-is-null.rs9
4 files changed, 27 insertions, 25 deletions
diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs
index 66c0de07a76..95b7c1c830e 100644
--- a/src/libcore/at_vec.rs
+++ b/src/libcore/at_vec.rs
@@ -198,3 +198,19 @@ mod unsafe {
     }
 
 }
+
+#[test]
+fn test() {
+    // Some code that could use that, then:
+    fn seq_range(lo: uint, hi: uint) -> @[uint] {
+        do build |push| {
+            for uint::range(lo, hi) |i| {
+                push(i);
+            }
+        }
+    }
+
+    assert seq_range(10, 15) == @[10, 11, 12, 13, 14];
+    assert from_fn(5, |x| x+1) == @[1, 2, 3, 4, 5];
+    assert from_elem(5, 3.14) == @[3.14, 3.14, 3.14, 3.14, 3.14];
+}
\ No newline at end of file
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index e1d21b826a5..cc60d18af21 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -200,3 +200,14 @@ fn test_buf_len() {
         }
     }
 }
+
+#[test]
+fn test_is_null() {
+   let p: *int = ptr::null();
+   assert p.is_null();
+   assert !p.is_not_null();
+
+   let q = ptr::offset(p, 1u);
+   assert !q.is_null();
+   assert q.is_not_null();
+}
\ No newline at end of file
diff --git a/src/test/run-pass/at_vec_building.rs b/src/test/run-pass/at_vec_building.rs
deleted file mode 100644
index 3202dfe221a..00000000000
--- a/src/test/run-pass/at_vec_building.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-import at_vec::{build, from_fn, from_elem};
-
-// Some code that could use that, then:
-fn seq_range(lo: uint, hi: uint) -> @[uint] {
-    do build |push| {
-        for uint::range(lo, hi) |i| {
-            push(i);
-        }
-    }
-}
-
-fn main() {
-    assert seq_range(10, 15) == @[10, 11, 12, 13, 14];
-    assert from_fn(5, |x| x+1) == @[1, 2, 3, 4, 5];
-    assert from_elem(5, 3.14) == @[3.14, 3.14, 3.14, 3.14, 3.14];
-}
diff --git a/src/test/run-pass/ptr-is-null.rs b/src/test/run-pass/ptr-is-null.rs
deleted file mode 100644
index a08c6cbccaa..00000000000
--- a/src/test/run-pass/ptr-is-null.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-fn main() {
-   let p: *int = ptr::null();
-   assert p.is_null();
-   assert !p.is_not_null();
-
-   let q = ptr::offset(p, 1u);
-   assert !q.is_null();
-   assert q.is_not_null();
-}