Skip to content

Commit

Permalink
test: Move two tests from run-pass into the libs
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Aug 1, 2012
1 parent 7b2026b commit c4bb8f8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 25 deletions.
16 changes: 16 additions & 0 deletions src/libcore/at_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
11 changes: 11 additions & 0 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
16 changes: 0 additions & 16 deletions src/test/run-pass/at_vec_building.rs

This file was deleted.

9 changes: 0 additions & 9 deletions src/test/run-pass/ptr-is-null.rs

This file was deleted.

0 comments on commit c4bb8f8

Please sign in to comment.