Skip to content

Commit c4bb8f8

Browse files
committed
test: Move two tests from run-pass into the libs
1 parent 7b2026b commit c4bb8f8

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

src/libcore/at_vec.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,19 @@ mod unsafe {
198198
}
199199

200200
}
201+
202+
#[test]
203+
fn test() {
204+
// Some code that could use that, then:
205+
fn seq_range(lo: uint, hi: uint) -> @[uint] {
206+
do build |push| {
207+
for uint::range(lo, hi) |i| {
208+
push(i);
209+
}
210+
}
211+
}
212+
213+
assert seq_range(10, 15) == @[10, 11, 12, 13, 14];
214+
assert from_fn(5, |x| x+1) == @[1, 2, 3, 4, 5];
215+
assert from_elem(5, 3.14) == @[3.14, 3.14, 3.14, 3.14, 3.14];
216+
}

src/libcore/ptr.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,14 @@ fn test_buf_len() {
200200
}
201201
}
202202
}
203+
204+
#[test]
205+
fn test_is_null() {
206+
let p: *int = ptr::null();
207+
assert p.is_null();
208+
assert !p.is_not_null();
209+
210+
let q = ptr::offset(p, 1u);
211+
assert !q.is_null();
212+
assert q.is_not_null();
213+
}

src/test/run-pass/at_vec_building.rs

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/test/run-pass/ptr-is-null.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)