Merge remote-tracking branch 'remotes/origin/incoming' into serial
This commit is contained in:
commit
0de7635f53
863 changed files with 5901 additions and 5914 deletions
|
|
@ -34,13 +34,13 @@ fn ascending<M: Map<uint, uint>>(map: &mut M, n_keys: uint) {
|
|||
|
||||
do timed("search") {
|
||||
for uint::range(0, n_keys) |i| {
|
||||
fail_unless!(map.find(&i).unwrap() == &(i + 1));
|
||||
assert!(map.find(&i).unwrap() == &(i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
do timed("remove") {
|
||||
for uint::range(0, n_keys) |i| {
|
||||
fail_unless!(map.remove(&i));
|
||||
assert!(map.remove(&i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -56,13 +56,13 @@ fn descending<M: Map<uint, uint>>(map: &mut M, n_keys: uint) {
|
|||
|
||||
do timed("search") {
|
||||
for uint::range_rev(n_keys, 0) |i| {
|
||||
fail_unless!(map.find(&i).unwrap() == &(i + 1));
|
||||
assert!(map.find(&i).unwrap() == &(i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
do timed("remove") {
|
||||
for uint::range_rev(n_keys, 0) |i| {
|
||||
fail_unless!(map.remove(&i));
|
||||
assert!(map.remove(&i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -77,13 +77,13 @@ fn vector<M: Map<uint, uint>>(map: &mut M, n_keys: uint, dist: &[uint]) {
|
|||
|
||||
do timed("search") {
|
||||
for uint::range(0, n_keys) |i| {
|
||||
fail_unless!(map.find(&dist[i]).unwrap() == &(i + 1));
|
||||
assert!(map.find(&dist[i]).unwrap() == &(i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
do timed("remove") {
|
||||
for uint::range(0, n_keys) |i| {
|
||||
fail_unless!(map.remove(&dist[i]));
|
||||
assert!(map.remove(&dist[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ pub impl Results {
|
|||
}
|
||||
|
||||
for uint::range(0, num_keys) |i| {
|
||||
fail_unless!(set.contains(&i));
|
||||
assert!(set.contains(&i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ pub impl Results {
|
|||
|
||||
do timed(&mut self.delete_ints) {
|
||||
for uint::range(0, num_keys) |i| {
|
||||
fail_unless!(set.remove(&i));
|
||||
assert!(set.remove(&i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ pub impl Results {
|
|||
|
||||
for uint::range(0, num_keys) |i| {
|
||||
let s = uint::to_str(i);
|
||||
fail_unless!(set.contains(&s));
|
||||
assert!(set.contains(&s));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ pub impl Results {
|
|||
}
|
||||
do timed(&mut self.delete_strings) {
|
||||
for uint::range(0, num_keys) |i| {
|
||||
fail_unless!(set.remove(&uint::to_str(i)));
|
||||
assert!(set.remove(&uint::to_str(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
|
|||
};
|
||||
result
|
||||
};
|
||||
fail_unless!((colors.len() == old_len));
|
||||
assert!((colors.len() == old_len));
|
||||
}
|
||||
|
||||
// Convert the results.
|
||||
|
|
@ -468,7 +468,7 @@ fn main() {
|
|||
|
||||
if do_validate {
|
||||
let start = time::precise_time_s();
|
||||
fail_unless!((validate(copy edges, *root, bfs_tree)));
|
||||
assert!((validate(copy edges, *root, bfs_tree)));
|
||||
let stop = time::precise_time_s();
|
||||
|
||||
io::stdout().write_line(
|
||||
|
|
@ -488,7 +488,7 @@ fn main() {
|
|||
|
||||
if do_validate {
|
||||
let start = time::precise_time_s();
|
||||
fail_unless!((validate(copy edges, *root, bfs_tree)));
|
||||
assert!((validate(copy edges, *root, bfs_tree)));
|
||||
let stop = time::precise_time_s();
|
||||
|
||||
io::stdout().write_line(
|
||||
|
|
@ -508,7 +508,7 @@ fn main() {
|
|||
|
||||
if do_validate {
|
||||
let start = time::precise_time_s();
|
||||
fail_unless!((validate(copy edges, *root, bfs_tree)));
|
||||
assert!((validate(copy edges, *root, bfs_tree)));
|
||||
let stop = time::precise_time_s();
|
||||
|
||||
io::stdout().write_line(fmt!("Validation completed in %? seconds.",
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ fn run(args: &[~str]) {
|
|||
io::stdout().write_str(fmt!("Test took %? seconds\n", elapsed));
|
||||
let thruput = ((size / workers * workers) as float) / (elapsed as float);
|
||||
io::stdout().write_str(fmt!("Throughput=%f per sec\n", thruput));
|
||||
fail_unless!(result == num_bytes * size);
|
||||
assert!(result == num_bytes * size);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ fn run(args: &[~str]) {
|
|||
io::stdout().write_str(fmt!("Test took %? seconds\n", elapsed));
|
||||
let thruput = ((size / workers * workers) as float) / (elapsed as float);
|
||||
io::stdout().write_str(fmt!("Throughput=%f per sec\n", thruput));
|
||||
fail_unless!(result == num_bytes * size);
|
||||
assert!(result == num_bytes * size);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ fn stress_task(&&id: int) {
|
|||
let mut i = 0;
|
||||
loop {
|
||||
let n = 15;
|
||||
fail_unless!((fib(n) == fib(n)));
|
||||
assert!((fib(n) == fib(n)));
|
||||
i += 1;
|
||||
error!("%d: Completed %d iterations", id, i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ fn append_sequential(min: uint, max: uint, map: &mut SmallIntMap<uint>) {
|
|||
|
||||
fn check_sequential(min: uint, max: uint, map: &SmallIntMap<uint>) {
|
||||
for uint::range(min, max) |i| {
|
||||
fail_unless!(*map.get(&i) == i + 22u);
|
||||
assert!(*map.get(&i) == i + 22u);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ pub impl Sudoku {
|
|||
}
|
||||
|
||||
pub fn read(reader: @io::Reader) -> Sudoku {
|
||||
fail_unless!(reader.read_line() == ~"9,9"); /* assert first line is exactly "9,9" */
|
||||
assert!(reader.read_line() == ~"9,9"); /* assert first line is exactly "9,9" */
|
||||
|
||||
let mut g = vec::from_fn(10u, { |_i| ~[0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8] });
|
||||
while !reader.eof() {
|
||||
|
|
@ -212,30 +212,30 @@ static default_solution: [[u8, ..9], ..9] = [
|
|||
|
||||
#[test]
|
||||
fn colors_new_works() {
|
||||
fail_unless!(*Colors::new(1) == 1022u16);
|
||||
fail_unless!(*Colors::new(2) == 1020u16);
|
||||
fail_unless!(*Colors::new(3) == 1016u16);
|
||||
fail_unless!(*Colors::new(4) == 1008u16);
|
||||
fail_unless!(*Colors::new(5) == 992u16);
|
||||
fail_unless!(*Colors::new(6) == 960u16);
|
||||
fail_unless!(*Colors::new(7) == 896u16);
|
||||
fail_unless!(*Colors::new(8) == 768u16);
|
||||
fail_unless!(*Colors::new(9) == 512u16);
|
||||
assert!(*Colors::new(1) == 1022u16);
|
||||
assert!(*Colors::new(2) == 1020u16);
|
||||
assert!(*Colors::new(3) == 1016u16);
|
||||
assert!(*Colors::new(4) == 1008u16);
|
||||
assert!(*Colors::new(5) == 992u16);
|
||||
assert!(*Colors::new(6) == 960u16);
|
||||
assert!(*Colors::new(7) == 896u16);
|
||||
assert!(*Colors::new(8) == 768u16);
|
||||
assert!(*Colors::new(9) == 512u16);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn colors_next_works() {
|
||||
fail_unless!(Colors(0).next() == 0u8);
|
||||
fail_unless!(Colors(2).next() == 1u8);
|
||||
fail_unless!(Colors(4).next() == 2u8);
|
||||
fail_unless!(Colors(8).next() == 3u8);
|
||||
fail_unless!(Colors(16).next() == 4u8);
|
||||
fail_unless!(Colors(32).next() == 5u8);
|
||||
fail_unless!(Colors(64).next() == 6u8);
|
||||
fail_unless!(Colors(128).next() == 7u8);
|
||||
fail_unless!(Colors(256).next() == 8u8);
|
||||
fail_unless!(Colors(512).next() == 9u8);
|
||||
fail_unless!(Colors(1024).next() == 0u8);
|
||||
assert!(Colors(0).next() == 0u8);
|
||||
assert!(Colors(2).next() == 1u8);
|
||||
assert!(Colors(4).next() == 2u8);
|
||||
assert!(Colors(8).next() == 3u8);
|
||||
assert!(Colors(16).next() == 4u8);
|
||||
assert!(Colors(32).next() == 5u8);
|
||||
assert!(Colors(64).next() == 6u8);
|
||||
assert!(Colors(128).next() == 7u8);
|
||||
assert!(Colors(256).next() == 8u8);
|
||||
assert!(Colors(512).next() == 9u8);
|
||||
assert!(Colors(1024).next() == 0u8);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -247,7 +247,7 @@ fn colors_remove_works() {
|
|||
colors.remove(1);
|
||||
|
||||
// THEN
|
||||
fail_unless!(colors.next() == 2u8);
|
||||
assert!(colors.next() == 2u8);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -260,7 +260,7 @@ fn check_default_sudoku_solution() {
|
|||
sudoku.solve();
|
||||
|
||||
// THEN
|
||||
fail_unless!(sudoku.equal(&solution));
|
||||
assert!(sudoku.equal(&solution));
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ fn spawn_supervised_blocking(myname: &str, +f: ~fn()) {
|
|||
task::task().future_result(|+r| res = Some(r)).supervised().spawn(f);
|
||||
error!("%s group waiting", myname);
|
||||
let x = res.unwrap().recv();
|
||||
fail_unless!(x == task::Success);
|
||||
assert!(x == task::Success);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
@ -81,5 +81,5 @@ fn main() {
|
|||
error!("Grandparent group wakes up and fails");
|
||||
fail!();
|
||||
};
|
||||
fail_unless!(x.is_err());
|
||||
assert!(x.is_err());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ fn main() {
|
|||
//~^ ERROR cannot infer an appropriate lifetime
|
||||
}
|
||||
// Adding this line causes a method unification failure instead
|
||||
// do (&option::unwrap(y)).read |state| { fail_unless!(*state == 1); }
|
||||
// do (&option::unwrap(y)).read |state| { assert!(*state == 1); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ fn main() {
|
|||
y = Some(write_mode);
|
||||
}
|
||||
// Adding this line causes a method unification failure instead
|
||||
// do (&option::unwrap(y)).write |state| { fail_unless!(*state == 1); }
|
||||
// do (&option::unwrap(y)).write |state| { assert!(*state == 1); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ fn main() {
|
|||
let b: clam = clam{x: @10, y: @20};
|
||||
let z: int = a.x + b.y; //~ ERROR binary operation + cannot be applied to type `@int`
|
||||
debug!(z);
|
||||
fail_unless!((z == 21));
|
||||
assert!((z == 21));
|
||||
let forty: fish = fish{a: @40};
|
||||
let two: fish = fish{a: @2};
|
||||
let answer: int = forty.a + two.a; //~ ERROR binary operation + cannot be applied to type `@int`
|
||||
debug!(answer);
|
||||
fail_unless!((answer == 42));
|
||||
assert!((answer == 42));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ fn main() {
|
|||
c.send(false);
|
||||
match x {
|
||||
Some(z) if z.recv() => { fail!() }, //~ ERROR cannot bind by-move into a pattern guard
|
||||
Some(z) => { fail_unless!(!z.recv()); },
|
||||
Some(z) => { assert!(!z.recv()); },
|
||||
None => fail!()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,5 +19,5 @@ fn compute1() -> float {
|
|||
fn main() {
|
||||
let x = compute1();
|
||||
debug!(x);
|
||||
fail_unless!((x == -4f));
|
||||
assert!((x == -4f));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ fn box_imm() {
|
|||
let mut v = ~3;
|
||||
do borrow(v) |w| { //~ NOTE loan of mutable local variable granted here
|
||||
v = ~4; //~ ERROR assigning to captured outer mutable variable in a stack closure prohibited due to outstanding loan
|
||||
fail_unless!(*v == 3);
|
||||
fail_unless!(*w == 4);
|
||||
assert!(*v == 3);
|
||||
assert!(*w == 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ fn destructure(x: Option<int>) -> int {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
fail_unless!(destructure(Some(22)) == 22);
|
||||
assert!(destructure(Some(22)) == 22);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@
|
|||
// except according to those terms.
|
||||
|
||||
// error-pattern: cast from nil: `()` as `u32`
|
||||
fn main() { let u = (fail_unless!(true) as u32); }
|
||||
fn main() { let u = (assert!(true) as u32); }
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ extern mod cr5_2 (name = "crateresolve5", vers = "0.2");
|
|||
|
||||
fn main() {
|
||||
// Nominal types from two multiple versions of a crate are different types
|
||||
fail_unless!(cr5_1::nominal() == cr5_2::nominal()); //~ ERROR mismatched types: expected
|
||||
assert!(cr5_1::nominal() == cr5_2::nominal()); //~ ERROR mismatched types: expected
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,6 @@
|
|||
fn f(f: @fn(int) -> bool) -> bool { f(10i) }
|
||||
|
||||
fn main() {
|
||||
fail_unless!(do f() |i| { i == 10i } == 10i);
|
||||
assert!(do f() |i| { i == 10i } == 10i);
|
||||
//~^ ERROR: expected `bool` but found `int`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@ fn main () {
|
|||
|
||||
let myInt: uint = (aFn.theFn)();
|
||||
|
||||
fail_unless!(myInt == 10);
|
||||
assert!(myInt == 10);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@ enum test { thing = 3u } //~ ERROR mismatched types
|
|||
//~^ ERROR expected signed integer constant
|
||||
fn main() {
|
||||
error!(thing as int);
|
||||
fail_unless!((thing as int == 3));
|
||||
assert!((thing as int == 3));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ fn main() {
|
|||
|
||||
let mut v = ~[];
|
||||
v = ~[(res)] + v; //~ instantiating a type parameter with an incompatible type `foo`, which does not fulfill `Copy`
|
||||
fail_unless!((v.len() == 2));
|
||||
assert!((v.len() == 2));
|
||||
}
|
||||
|
||||
fail_unless!(*x == 1);
|
||||
assert!(*x == 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@ fn main()
|
|||
let mut x = [1, 2, 4];
|
||||
let v : &int = &x[2];
|
||||
x[2] = 6;
|
||||
fail_unless!(*v == 6);
|
||||
assert!(*v == 6);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,17 +25,17 @@ fn vec_peek<'r, T>(v: &'r [T]) -> Option< (&'r T, &'r [T]) > {
|
|||
|
||||
fn test_peek_empty_stack() {
|
||||
let v : &[int] = &[];
|
||||
fail_unless!((None == vec_peek(v)));
|
||||
assert!((None == vec_peek(v)));
|
||||
}
|
||||
|
||||
fn test_peek_empty_unique() {
|
||||
let v : ~[int] = ~[];
|
||||
fail_unless!((None == vec_peek(v)));
|
||||
assert!((None == vec_peek(v)));
|
||||
}
|
||||
|
||||
fn test_peek_empty_managed() {
|
||||
let v : @[int] = @[];
|
||||
fail_unless!((None == vec_peek(v)));
|
||||
assert!((None == vec_peek(v)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ extern mod std;
|
|||
use core::cmp::Eq;
|
||||
|
||||
fn f<T:Eq>(o: &mut Option<T>) {
|
||||
fail_unless!(*o == option::None);
|
||||
assert!(*o == option::None);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@ mod ctr {
|
|||
fn main() {
|
||||
let c = ctr::new(42);
|
||||
let c2 = ctr::inc(c);
|
||||
fail_unless!(*c2 == 5); //~ ERROR can only dereference enums with a single, public variant
|
||||
assert!(*c2 == 5); //~ ERROR can only dereference enums with a single, public variant
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,5 +27,5 @@ fn main() {
|
|||
let x: &'blk int = &3;
|
||||
repeater(@x)
|
||||
};
|
||||
fail_unless!(3 == *(y.get())); //~ ERROR reference is not valid
|
||||
assert!(3 == *(y.get())); //~ ERROR reference is not valid
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ fn to_foo<T:Copy>(t: T) {
|
|||
let v = &3;
|
||||
struct F<T> { f: T }
|
||||
let x = @F {f:t} as @foo;
|
||||
fail_unless!(x.foo(v) == 3);
|
||||
assert!(x.foo(v) == 3);
|
||||
}
|
||||
|
||||
fn to_foo_2<T:Copy>(t: T) -> @foo {
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@
|
|||
mod mod_file_aux;
|
||||
|
||||
fn main() {
|
||||
fail_unless!(mod_file_aux::bar() == 10); //~ ERROR unresolved name
|
||||
assert!(mod_file_aux::bar() == 10); //~ ERROR unresolved name
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@
|
|||
mod not_a_real_file; //~ ERROR not_a_real_file.rs
|
||||
|
||||
fn main() {
|
||||
fail_unless!(mod_file_aux::bar() == 10);
|
||||
assert!(mod_file_aux::bar() == 10);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@
|
|||
mod m; //~ ERROR not_a_real_file.rs
|
||||
|
||||
fn main() {
|
||||
fail_unless!(m::foo() == 10);
|
||||
assert!(m::foo() == 10);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@ fn apply_int(f: &fn(int) -> int, a: int) -> int { f(a) }
|
|||
|
||||
fn main() {
|
||||
let f = {|i| i};
|
||||
fail_unless!(apply_int(f, 2) == 2);
|
||||
fail_unless!(apply(f, 2) == 2); //~ ERROR expected argument mode &&
|
||||
assert!(apply_int(f, 2) == 2);
|
||||
assert!(apply(f, 2) == 2); //~ ERROR expected argument mode &&
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ fn main() {
|
|||
|
||||
do task::spawn() {
|
||||
let v = *arc::get(&arc_v);
|
||||
fail_unless!(v[3] == 4);
|
||||
assert!(v[3] == 4);
|
||||
};
|
||||
|
||||
fail_unless!((*arc::get(&arc_v))[2] == 3);
|
||||
assert!((*arc::get(&arc_v))[2] == 3);
|
||||
|
||||
info!(arc_v);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ fn main() {
|
|||
|
||||
do task::spawn() { //~ NOTE `arc_v` moved into closure environment here
|
||||
let v = *arc::get(&arc_v);
|
||||
fail_unless!(v[3] == 4);
|
||||
assert!(v[3] == 4);
|
||||
};
|
||||
|
||||
fail_unless!((*arc::get(&arc_v))[2] == 3); //~ ERROR use of moved value: `arc_v`
|
||||
assert!((*arc::get(&arc_v))[2] == 3); //~ ERROR use of moved value: `arc_v`
|
||||
|
||||
info!(arc_v);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ fn main() {
|
|||
let x = Some(unstable::exclusive(false));
|
||||
match x {
|
||||
Some(copy z) => { //~ ERROR copying a value of non-copyable type
|
||||
do z.with |b| { fail_unless!(!*b); }
|
||||
do z.with |b| { assert!(!*b); }
|
||||
}
|
||||
None => fail!()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@
|
|||
fn let_in<T>(x: T, f: &fn(T)) {}
|
||||
|
||||
fn main() {
|
||||
let_in(3u, |i| { fail_unless!(i == 3); });
|
||||
let_in(3u, |i| { assert!(i == 3); });
|
||||
//~^ ERROR expected `uint` but found `int`
|
||||
|
||||
let_in(3, |i| { fail_unless!(i == 3u); });
|
||||
let_in(3, |i| { assert!(i == 3u); });
|
||||
//~^ ERROR expected `int` but found `uint`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,5 +14,5 @@ use cci_class::kitties::*;
|
|||
|
||||
fn main() {
|
||||
let nyan : cat = cat(52u, 99);
|
||||
fail_unless!((nyan.meows == 52u)); //~ ERROR field `meows` is private
|
||||
assert!((nyan.meows == 52u)); //~ ERROR field `meows` is private
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@ mod cat {
|
|||
|
||||
fn main() {
|
||||
let nyan = cat::new_cat();
|
||||
fail_unless!(nyan.meows == 52); //~ ERROR field `meows` is private
|
||||
assert!(nyan.meows == 52); //~ ERROR field `meows` is private
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,5 +37,5 @@ mod argparse {
|
|||
fn main () {
|
||||
let f : argparse::Flag = argparse::flag(~"flag", ~"My flag");
|
||||
let updated_flag = f.set_desc(~"My new flag");
|
||||
fail_unless!(updated_flag.desc == "My new flag");
|
||||
assert!(updated_flag.desc == "My new flag");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ fn x_coord<'r>(p: &'r point) -> &'r int {
|
|||
|
||||
fn foo(p: @point) -> &int {
|
||||
let xc = x_coord(p); //~ ERROR illegal borrow
|
||||
fail_unless!(*xc == 3);
|
||||
assert!(*xc == 3);
|
||||
return xc;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ fn foo(cond: &fn() -> bool, box: &fn() -> @int) {
|
|||
// of this borrow is the fn body as a whole.
|
||||
y = borrow(x); //~ ERROR illegal borrow: cannot root managed value long enough
|
||||
|
||||
fail_unless!(*x == *y);
|
||||
assert!(*x == *y);
|
||||
if cond() { break; }
|
||||
}
|
||||
fail_unless!(*y != 0);
|
||||
assert!(*y != 0);
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -34,5 +34,5 @@ fn get_v(gc: @get_ctxt) -> uint {
|
|||
fn main() {
|
||||
let ctxt = ctxt { v: 22u };
|
||||
let hc = has_ctxt { c: &ctxt };
|
||||
fail_unless!(get_v(@hc as @get_ctxt) == 22u);
|
||||
assert!(get_v(@hc as @get_ctxt) == 22u);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ fn foo(cond: bool) {
|
|||
|
||||
if cond {
|
||||
x = &3; //~ ERROR illegal borrow: borrowed value does not live long enough
|
||||
fail_unless!((*x == 3));
|
||||
assert!((*x == 3));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@
|
|||
|
||||
enum quux<T> { bar }
|
||||
|
||||
fn foo(c: quux) { fail_unless!((false)); }
|
||||
fn foo(c: quux) { assert!((false)); }
|
||||
|
||||
fn main() { fail!(); }
|
||||
|
|
|
|||
|
|
@ -29,5 +29,5 @@ fn call_it<B:TraitB>(b: B) -> int {
|
|||
|
||||
fn main() {
|
||||
let x = 3i;
|
||||
fail_unless!(call_it(x) == 22);
|
||||
assert!(call_it(x) == 22);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@
|
|||
|
||||
fn f(f: @fn(int)) { f(10) }
|
||||
|
||||
fn main() { do f |i| { fail_unless!(i == 10) } }
|
||||
fn main() { do f |i| { assert!(i == 10) } }
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ struct Thing {
|
|||
fn main() {
|
||||
let sth = Thing{x: 0, y: 1,};
|
||||
let sth2 = Thing{y: 9 , ..sth};
|
||||
fail_unless!(sth.x + sth2.y == 9);
|
||||
assert!(sth.x + sth2.y == 9);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// error-pattern:assertion failed: 1 == 2
|
||||
|
||||
fn main() {
|
||||
fail_unless!(1 == 2);
|
||||
assert!(1 == 2);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@
|
|||
|
||||
|
||||
// error-pattern:1 == 2
|
||||
fn main() { fail_unless!((1 == 2)); }
|
||||
fn main() { assert!((1 == 2)); }
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@
|
|||
// error-pattern:custom message
|
||||
|
||||
fn main() {
|
||||
fail_unless!(false, "custom message");
|
||||
assert!(false, "custom message");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
// error-pattern:1 == 2
|
||||
extern mod std;
|
||||
|
||||
fn child() { fail_unless!((1 == 2)); }
|
||||
fn child() { assert!((1 == 2)); }
|
||||
|
||||
fn main() {
|
||||
let (p, _c) = comm::stream::<int>();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
// error-pattern:1 == 2
|
||||
|
||||
fn child() { fail_unless!((1 == 2)); }
|
||||
fn child() { assert!((1 == 2)); }
|
||||
|
||||
fn parent() {
|
||||
let (p, _c) = comm::stream::<int>();
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@ fn main() {
|
|||
let s: ~str = ~"hello";
|
||||
|
||||
// Bounds-check failure.
|
||||
fail_unless!((s[5] == 0x0 as u8));
|
||||
assert!((s[5] == 0x0 as u8));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@ fn main() {
|
|||
}
|
||||
|
||||
fn startfn() {
|
||||
fail_unless!(str::is_empty(~"Ensure that the child task runs by failing"));
|
||||
assert!(str::is_empty(~"Ensure that the child task runs by failing"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ fn test_box() {
|
|||
fn test_str() {
|
||||
let res = match false { true => { ~"happy" },
|
||||
_ => fail!(~"non-exhaustive match failure") };
|
||||
fail_unless!(res == ~"happy");
|
||||
assert!(res == ~"happy");
|
||||
}
|
||||
fn main() {
|
||||
test_box();
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@
|
|||
|
||||
fn main() {
|
||||
let a = @0;
|
||||
fail_unless!(false);
|
||||
assert!(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
fn main() {
|
||||
let v: ~[int] = ~[10];
|
||||
let x: int = 0;
|
||||
fail_unless!((v[x] == 10));
|
||||
assert!((v[x] == 10));
|
||||
// Bounds-check failure.
|
||||
|
||||
fail_unless!((v[x + 2] == 20));
|
||||
assert!((v[x + 2] == 20));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
fn main() {
|
||||
let v: ~[int] = ~[10, 20];
|
||||
let x: int = 0;
|
||||
fail_unless!((v[x] == 10));
|
||||
assert!((v[x] == 10));
|
||||
// Bounds-check failure.
|
||||
|
||||
fail_unless!((v[x - 1] == 20));
|
||||
assert!((v[x - 1] == 20));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ extern mod std;
|
|||
use core::vec::{same_length, zip};
|
||||
|
||||
fn enum_chars(start: u8, end: u8) -> ~[char] {
|
||||
fail_unless!(start < end);
|
||||
assert!(start < end);
|
||||
let mut i = start;
|
||||
let mut r = ~[];
|
||||
while i <= end { r.push(i as char); i += 1 as u8; }
|
||||
|
|
@ -23,7 +23,7 @@ fn enum_chars(start: u8, end: u8) -> ~[char] {
|
|||
}
|
||||
|
||||
fn enum_uints(start: uint, end: uint) -> ~[uint] {
|
||||
fail_unless!(start < end);
|
||||
assert!(start < end);
|
||||
let mut i = start;
|
||||
let mut r = ~[];
|
||||
while i <= end { r.push(i); i += 1; }
|
||||
|
|
@ -35,7 +35,7 @@ fn main() {
|
|||
let chars = enum_chars(a, j);
|
||||
let ints = enum_uints(k, l);
|
||||
|
||||
fail_unless!(same_length(chars, ints));
|
||||
assert!(same_length(chars, ints));
|
||||
let ps = zip(chars, ints);
|
||||
fail!(~"the impossible happened");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ fn check_pp<T>(cx: fake_ext_ctxt,
|
|||
stdout().write_line(s);
|
||||
if expect != ~"" {
|
||||
error!("expect: '%s', got: '%s'", expect, s);
|
||||
fail_unless!(s == expect);
|
||||
assert!(s == expect);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,6 @@ fn f<A:Copy + 'static>(a: A, b: u16) -> @fn() -> (A, u16) {
|
|||
pub fn main() {
|
||||
let (a, b) = f(22_u64, 44u16)();
|
||||
debug!("a=%? b=%?", a, b);
|
||||
fail_unless!(a == 22u64);
|
||||
fail_unless!(b == 44u16);
|
||||
assert!(a == 22u64);
|
||||
assert!(b == 44u16);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,6 @@ pub fn main() {
|
|||
make_cycle(z);
|
||||
let (a, b) = z();
|
||||
debug!("a=%u b=%u", *a as uint, b as uint);
|
||||
fail_unless!(*a == x);
|
||||
fail_unless!(b == y);
|
||||
assert!(*a == x);
|
||||
assert!(b == y);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ pub fn main() {
|
|||
let mut x = ~Pair {a: ~10, b: ~20};
|
||||
match x {
|
||||
~Pair {a: ref mut a, b: ref mut b} => {
|
||||
fail_unless!(**a == 10); *a = ~30; fail_unless!(**a == 30);
|
||||
assert!(**a == 10); *a = ~30; assert!(**a == 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ fn foo(s: @int) {
|
|||
_ => { debug!("?"); fail!(); }
|
||||
}
|
||||
debug!(::core::sys::refcount(s));
|
||||
fail_unless!((::core::sys::refcount(s) == count + 1u));
|
||||
assert!((::core::sys::refcount(s) == count + 1u));
|
||||
let _ = ::core::sys::refcount(s); // don't get bitten by last-use.
|
||||
}
|
||||
|
||||
|
|
@ -39,5 +39,5 @@ pub fn main() {
|
|||
debug!("%u", ::core::sys::refcount(s));
|
||||
let count2 = ::core::sys::refcount(s);
|
||||
let _ = ::core::sys::refcount(s); // don't get bitten by last-use.
|
||||
fail_unless!(count == count2);
|
||||
assert!(count == count2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,4 +18,4 @@ fn altlit(f: int) -> int {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn main() { fail_unless!((altlit(10) == 20)); fail_unless!((altlit(11) == 22)); }
|
||||
pub fn main() { assert!((altlit(10) == 20)); assert!((altlit(11) == 22)); }
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pub fn main() {
|
|||
let x = Some(unstable::exclusive(true));
|
||||
match x {
|
||||
Some(ref z) if z.with(|b| *b) => {
|
||||
do z.with |b| { fail_unless!(*b); }
|
||||
do z.with |b| { assert!(*b); }
|
||||
},
|
||||
_ => fail!()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,5 +14,5 @@ pub fn main() {
|
|||
None => {}
|
||||
Some(ref mut p) => { *p += 1; }
|
||||
}
|
||||
fail_unless!(v == Some(23));
|
||||
assert!(v == Some(23));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,5 +21,5 @@ fn destructure(x: &mut Rec) {
|
|||
pub fn main() {
|
||||
let mut v = Rec {f: 22};
|
||||
destructure(&mut v);
|
||||
fail_unless!(v.f == 23);
|
||||
assert!(v.f == 23);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ fn destructure(x: Option<int>) -> int {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
fail_unless!(destructure(Some(22)) == 22);
|
||||
assert!(destructure(Some(22)) == 22);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ pub fn main() {
|
|||
}
|
||||
|
||||
let x = match ~"a" { ~"a" => 1, ~"b" => 2, _ => fail!() };
|
||||
fail_unless!((x == 1));
|
||||
assert!((x == 1));
|
||||
|
||||
match ~"a" { ~"a" => { } ~"b" => { }, _ => fail!() }
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ pub fn main() {
|
|||
let gray: color = rgb(127, 127, 127);
|
||||
let clear: color = rgba(50, 150, 250, 0);
|
||||
let red: color = hsl(0, 255, 255);
|
||||
fail_unless!((process(gray) == 127));
|
||||
fail_unless!((process(clear) == 0));
|
||||
fail_unless!((process(red) == 255));
|
||||
assert!((process(gray) == 127));
|
||||
assert!((process(clear) == 0));
|
||||
assert!((process(red) == 255));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pub fn main() {
|
|||
match ~100 {
|
||||
~x => {
|
||||
debug!("%?", x);
|
||||
fail_unless!(x == 100);
|
||||
assert!(x == 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ pub fn main() {
|
|||
None => return (),
|
||||
Some(num) => num as u32
|
||||
};
|
||||
fail_unless!(f == 1234u32);
|
||||
assert!(f == 1234u32);
|
||||
error!(f)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ fn f2(a: int, f: &fn(int)) -> int { f(1); return a; }
|
|||
|
||||
pub fn main() {
|
||||
let mut a = X {x: 1}, b = 2, c = 3;
|
||||
fail_unless!((f1(&mut a, &mut b, c) == 6));
|
||||
fail_unless!((a.x == 0));
|
||||
fail_unless!((b == 10));
|
||||
fail_unless!((f2(a.x, |x| a.x = 50) == 0));
|
||||
fail_unless!((a.x == 50));
|
||||
assert!((f1(&mut a, &mut b, c) == 6));
|
||||
assert!((a.x == 0));
|
||||
assert!((b == 10));
|
||||
assert!((f2(a.x, |x| a.x = 50) == 0));
|
||||
assert!((a.x == 50));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@
|
|||
pub fn main() {
|
||||
let a: int = 10;
|
||||
debug!(a);
|
||||
fail_unless!((a * (a - 1) == 90));
|
||||
assert!((a * (a - 1) == 90));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,22 +12,22 @@
|
|||
|
||||
pub fn main() {
|
||||
let i32_a: int = 10;
|
||||
fail_unless!((i32_a == 10));
|
||||
fail_unless!((i32_a - 10 == 0));
|
||||
fail_unless!((i32_a / 10 == 1));
|
||||
fail_unless!((i32_a - 20 == -10));
|
||||
fail_unless!((i32_a << 10 == 10240));
|
||||
fail_unless!((i32_a << 16 == 655360));
|
||||
fail_unless!((i32_a * 16 == 160));
|
||||
fail_unless!((i32_a * i32_a * i32_a == 1000));
|
||||
fail_unless!((i32_a * i32_a * i32_a * i32_a == 10000));
|
||||
fail_unless!((i32_a * i32_a / i32_a * i32_a == 100));
|
||||
fail_unless!((i32_a * (i32_a - 1) << 2 + i32_a == 368640));
|
||||
assert!((i32_a == 10));
|
||||
assert!((i32_a - 10 == 0));
|
||||
assert!((i32_a / 10 == 1));
|
||||
assert!((i32_a - 20 == -10));
|
||||
assert!((i32_a << 10 == 10240));
|
||||
assert!((i32_a << 16 == 655360));
|
||||
assert!((i32_a * 16 == 160));
|
||||
assert!((i32_a * i32_a * i32_a == 1000));
|
||||
assert!((i32_a * i32_a * i32_a * i32_a == 10000));
|
||||
assert!((i32_a * i32_a / i32_a * i32_a == 100));
|
||||
assert!((i32_a * (i32_a - 1) << 2 + i32_a == 368640));
|
||||
let i32_b: int = 0x10101010;
|
||||
fail_unless!((i32_b + 1 - 1 == i32_b));
|
||||
fail_unless!((i32_b << 1 == i32_b << 1));
|
||||
fail_unless!((i32_b >> 1 == i32_b >> 1));
|
||||
fail_unless!((i32_b & i32_b << 1 == 0));
|
||||
assert!((i32_b + 1 - 1 == i32_b));
|
||||
assert!((i32_b << 1 == i32_b << 1));
|
||||
assert!((i32_b >> 1 == i32_b >> 1));
|
||||
assert!((i32_b & i32_b << 1 == 0));
|
||||
debug!(i32_b | i32_b << 1);
|
||||
fail_unless!((i32_b | i32_b << 1 == 0x30303030));
|
||||
assert!((i32_b | i32_b << 1 == 0x30303030));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@
|
|||
|
||||
pub fn main() {
|
||||
let i32_c: int = 0x10101010;
|
||||
fail_unless!(i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3) ==
|
||||
assert!(i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3) ==
|
||||
i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,24 +13,24 @@
|
|||
|
||||
// Unsigned integer operations
|
||||
pub fn main() {
|
||||
fail_unless!((0u8 < 255u8));
|
||||
fail_unless!((0u8 <= 255u8));
|
||||
fail_unless!((255u8 > 0u8));
|
||||
fail_unless!((255u8 >= 0u8));
|
||||
fail_unless!((250u8 / 10u8 == 25u8));
|
||||
fail_unless!((255u8 % 10u8 == 5u8));
|
||||
fail_unless!((0u16 < 60000u16));
|
||||
fail_unless!((0u16 <= 60000u16));
|
||||
fail_unless!((60000u16 > 0u16));
|
||||
fail_unless!((60000u16 >= 0u16));
|
||||
fail_unless!((60000u16 / 10u16 == 6000u16));
|
||||
fail_unless!((60005u16 % 10u16 == 5u16));
|
||||
fail_unless!((0u32 < 4000000000u32));
|
||||
fail_unless!((0u32 <= 4000000000u32));
|
||||
fail_unless!((4000000000u32 > 0u32));
|
||||
fail_unless!((4000000000u32 >= 0u32));
|
||||
fail_unless!((4000000000u32 / 10u32 == 400000000u32));
|
||||
fail_unless!((4000000005u32 % 10u32 == 5u32));
|
||||
assert!((0u8 < 255u8));
|
||||
assert!((0u8 <= 255u8));
|
||||
assert!((255u8 > 0u8));
|
||||
assert!((255u8 >= 0u8));
|
||||
assert!((250u8 / 10u8 == 25u8));
|
||||
assert!((255u8 % 10u8 == 5u8));
|
||||
assert!((0u16 < 60000u16));
|
||||
assert!((0u16 <= 60000u16));
|
||||
assert!((60000u16 > 0u16));
|
||||
assert!((60000u16 >= 0u16));
|
||||
assert!((60000u16 / 10u16 == 6000u16));
|
||||
assert!((60005u16 % 10u16 == 5u16));
|
||||
assert!((0u32 < 4000000000u32));
|
||||
assert!((0u32 <= 4000000000u32));
|
||||
assert!((4000000000u32 > 0u32));
|
||||
assert!((4000000000u32 >= 0u32));
|
||||
assert!((4000000000u32 / 10u32 == 400000000u32));
|
||||
assert!((4000000005u32 % 10u32 == 5u32));
|
||||
// 64-bit numbers have some flakiness yet. Not tested
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,4 +10,4 @@
|
|||
|
||||
fn f() -> int { { return 3; } }
|
||||
|
||||
pub fn main() { fail_unless!((f() == 3)); }
|
||||
pub fn main() { assert!((f() == 3)); }
|
||||
|
|
|
|||
|
|
@ -12,21 +12,21 @@
|
|||
fn test_assign() {
|
||||
let mut x: int;
|
||||
let mut y: () = x = 10;
|
||||
fail_unless!((x == 10));
|
||||
assert!((x == 10));
|
||||
let mut z = x = 11;
|
||||
fail_unless!((x == 11));
|
||||
assert!((x == 11));
|
||||
z = x = 12;
|
||||
fail_unless!((x == 12));
|
||||
assert!((x == 12));
|
||||
}
|
||||
|
||||
fn test_assign_op() {
|
||||
let mut x: int = 0;
|
||||
let mut y: () = x += 10;
|
||||
fail_unless!((x == 10));
|
||||
assert!((x == 10));
|
||||
let mut z = x += 11;
|
||||
fail_unless!((x == 21));
|
||||
assert!((x == 21));
|
||||
z = x += 12;
|
||||
fail_unless!((x == 33));
|
||||
assert!((x == 33));
|
||||
}
|
||||
|
||||
pub fn main() { test_assign(); test_assign_op(); }
|
||||
|
|
|
|||
|
|
@ -41,17 +41,17 @@ fn length<A, T: iterable<A>>(x: T) -> uint {
|
|||
pub fn main() {
|
||||
let x = ~[0,1,2,3];
|
||||
// Call a method
|
||||
for x.iterate() |y| { fail_unless!(x[*y] == *y); }
|
||||
for x.iterate() |y| { assert!(x[*y] == *y); }
|
||||
// Call a parameterized function
|
||||
fail_unless!(length(x.clone()) == vec::len(x));
|
||||
assert!(length(x.clone()) == vec::len(x));
|
||||
// Call a parameterized function, with type arguments that require
|
||||
// a borrow
|
||||
fail_unless!(length::<int, &[int]>(x) == vec::len(x));
|
||||
assert!(length::<int, &[int]>(x) == vec::len(x));
|
||||
|
||||
// Now try it with a type that *needs* to be borrowed
|
||||
let z = [0,1,2,3];
|
||||
// Call a method
|
||||
for z.iterate() |y| { fail_unless!(z[*y] == *y); }
|
||||
for z.iterate() |y| { assert!(z[*y] == *y); }
|
||||
// Call a parameterized function
|
||||
fail_unless!(length::<int, &[int]>(z) == vec::len(z));
|
||||
assert!(length::<int, &[int]>(z) == vec::len(z));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ fn test_ebml<A:
|
|||
};
|
||||
let d = EBReader::Doc(@bytes);
|
||||
let a2: A = Decodable::decode(&EBReader::Decoder(d));
|
||||
fail_unless!(*a1 == a2);
|
||||
assert!(*a1 == a2);
|
||||
}
|
||||
|
||||
#[auto_encode]
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@ pub fn main() {
|
|||
for vec::each(~[1, 2, 3, 4, 5]) |x| {
|
||||
sum += *x;
|
||||
}
|
||||
fail_unless!((sum == 15));
|
||||
assert!((sum == 15));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ pub impl Foo {
|
|||
|
||||
pub fn main() {
|
||||
let m = Foo(3);
|
||||
fail_unless!(m.len() == 3);
|
||||
assert!(m.len() == 3);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ trait MyIter {
|
|||
}
|
||||
|
||||
impl<'self> MyIter for &'self [int] {
|
||||
fn test_imm(&self) { fail_unless!(self[0] == 1) }
|
||||
fn test_const(&const self) { fail_unless!(self[0] == 1) }
|
||||
fn test_imm(&self) { assert!(self[0] == 1) }
|
||||
fn test_const(&const self) { assert!(self[0] == 1) }
|
||||
}
|
||||
|
||||
impl<'self> MyIter for &'self str {
|
||||
fn test_imm(&self) { fail_unless!(*self == "test") }
|
||||
fn test_const(&const self) { fail_unless!(*self == "test") }
|
||||
fn test_imm(&self) { assert!(*self == "test") }
|
||||
fn test_const(&const self) { assert!(*self == "test") }
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -22,5 +22,5 @@ pub fn main() {
|
|||
let mut v = ~[1];
|
||||
v.push_val(2);
|
||||
v.push_val(3);
|
||||
fail_unless!(v == ~[1, 2, 3]);
|
||||
assert!(v == ~[1, 2, 3]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ fn f<T:Copy>(x: ~[T]) -> T { return x[0]; }
|
|||
fn g(act: &fn(~[int]) -> int) -> int { return act(~[1, 2, 3]); }
|
||||
|
||||
pub fn main() {
|
||||
fail_unless!((g(f) == 1));
|
||||
assert!((g(f) == 1));
|
||||
let f1: &fn(~[~str]) -> ~str = f;
|
||||
fail_unless!((f1(~[~"x", ~"y", ~"z"]) == ~"x"));
|
||||
assert!((f1(~[~"x", ~"y", ~"z"]) == ~"x"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@ struct foo(uint);
|
|||
|
||||
pub fn main() {
|
||||
let x = foo(3u);
|
||||
fail_unless!(x.double() == 6u);
|
||||
assert!(x.double() == 6u);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ impl double for uint {
|
|||
|
||||
pub fn main() {
|
||||
let x = @(@3u as @double);
|
||||
fail_unless!(x.double() == 6u);
|
||||
assert!(x.double() == 6u);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,5 +25,5 @@ impl double for @uint {
|
|||
|
||||
pub fn main() {
|
||||
let x = @3u;
|
||||
fail_unless!(x.double() == 6u);
|
||||
assert!(x.double() == 6u);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ impl double for @uint {
|
|||
|
||||
pub fn main() {
|
||||
let x = @@@@@3u;
|
||||
fail_unless!(x.double() == 6u);
|
||||
assert!(x.double() == 6u);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ impl double for uint {
|
|||
|
||||
pub fn main() {
|
||||
let x = @@3u;
|
||||
fail_unless!(x.double() == 6u);
|
||||
assert!(x.double() == 6u);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ impl double for uint {
|
|||
|
||||
pub fn main() {
|
||||
let x = @3u;
|
||||
fail_unless!(x.double() == 6u);
|
||||
assert!(x.double() == 6u);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@ impl Foo for uint {
|
|||
|
||||
pub fn main() {
|
||||
let x = @3u;
|
||||
fail_unless!(x.foo() == ~"@3");
|
||||
assert!(x.foo() == ~"@3");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@
|
|||
// except according to those terms.
|
||||
|
||||
pub fn main() {
|
||||
fail_unless!(0xffffffffu32 == (-1 as u32));
|
||||
fail_unless!(4294967295u32 == (-1 as u32));
|
||||
fail_unless!(0xffffffffffffffffu64 == (-1 as u64));
|
||||
fail_unless!(18446744073709551615u64 == (-1 as u64));
|
||||
assert!(0xffffffffu32 == (-1 as u32));
|
||||
assert!(4294967295u32 == (-1 as u32));
|
||||
assert!(0xffffffffffffffffu64 == (-1 as u64));
|
||||
assert!(18446744073709551615u64 == (-1 as u64));
|
||||
|
||||
fail_unless!(-2147483648i32 - 1i32 == 2147483647i32);
|
||||
fail_unless!(-9223372036854775808i64 - 1i64 == 9223372036854775807i64);
|
||||
assert!(-2147483648i32 - 1i32 == 2147483647i32);
|
||||
assert!(-9223372036854775808i64 - 1i64 == 9223372036854775807i64);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@
|
|||
|
||||
pub fn main() {
|
||||
match -1 { -1 => {}, _ => fail!(~"wat") }
|
||||
fail_unless!(1-1 == 0);
|
||||
assert!(1-1 == 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,55 +11,55 @@
|
|||
// Binop corner cases
|
||||
|
||||
fn test_nil() {
|
||||
fail_unless!((() == ()));
|
||||
fail_unless!((!(() != ())));
|
||||
fail_unless!((!(() < ())));
|
||||
fail_unless!((() <= ()));
|
||||
fail_unless!((!(() > ())));
|
||||
fail_unless!((() >= ()));
|
||||
assert!((() == ()));
|
||||
assert!((!(() != ())));
|
||||
assert!((!(() < ())));
|
||||
assert!((() <= ()));
|
||||
assert!((!(() > ())));
|
||||
assert!((() >= ()));
|
||||
}
|
||||
|
||||
fn test_bool() {
|
||||
fail_unless!((!(true < false)));
|
||||
fail_unless!((!(true <= false)));
|
||||
fail_unless!((true > false));
|
||||
fail_unless!((true >= false));
|
||||
assert!((!(true < false)));
|
||||
assert!((!(true <= false)));
|
||||
assert!((true > false));
|
||||
assert!((true >= false));
|
||||
|
||||
fail_unless!((false < true));
|
||||
fail_unless!((false <= true));
|
||||
fail_unless!((!(false > true)));
|
||||
fail_unless!((!(false >= true)));
|
||||
assert!((false < true));
|
||||
assert!((false <= true));
|
||||
assert!((!(false > true)));
|
||||
assert!((!(false >= true)));
|
||||
|
||||
// Bools support bitwise binops
|
||||
fail_unless!((false & false == false));
|
||||
fail_unless!((true & false == false));
|
||||
fail_unless!((true & true == true));
|
||||
fail_unless!((false | false == false));
|
||||
fail_unless!((true | false == true));
|
||||
fail_unless!((true | true == true));
|
||||
fail_unless!((false ^ false == false));
|
||||
fail_unless!((true ^ false == true));
|
||||
fail_unless!((true ^ true == false));
|
||||
assert!((false & false == false));
|
||||
assert!((true & false == false));
|
||||
assert!((true & true == true));
|
||||
assert!((false | false == false));
|
||||
assert!((true | false == true));
|
||||
assert!((true | true == true));
|
||||
assert!((false ^ false == false));
|
||||
assert!((true ^ false == true));
|
||||
assert!((true ^ true == false));
|
||||
}
|
||||
|
||||
fn test_char() {
|
||||
let ch10 = 10 as char;
|
||||
let ch4 = 4 as char;
|
||||
let ch2 = 2 as char;
|
||||
fail_unless!((ch10 + ch4 == 14 as char));
|
||||
fail_unless!((ch10 - ch4 == 6 as char));
|
||||
fail_unless!((ch10 * ch4 == 40 as char));
|
||||
fail_unless!((ch10 / ch4 == ch2));
|
||||
fail_unless!((ch10 % ch4 == ch2));
|
||||
fail_unless!((ch10 >> ch2 == ch2));
|
||||
fail_unless!((ch10 << ch4 == 160 as char));
|
||||
fail_unless!((ch10 | ch4 == 14 as char));
|
||||
fail_unless!((ch10 & ch2 == ch2));
|
||||
fail_unless!((ch10 ^ ch2 == 8 as char));
|
||||
assert!((ch10 + ch4 == 14 as char));
|
||||
assert!((ch10 - ch4 == 6 as char));
|
||||
assert!((ch10 * ch4 == 40 as char));
|
||||
assert!((ch10 / ch4 == ch2));
|
||||
assert!((ch10 % ch4 == ch2));
|
||||
assert!((ch10 >> ch2 == ch2));
|
||||
assert!((ch10 << ch4 == 160 as char));
|
||||
assert!((ch10 | ch4 == 14 as char));
|
||||
assert!((ch10 & ch2 == ch2));
|
||||
assert!((ch10 ^ ch2 == 8 as char));
|
||||
}
|
||||
|
||||
fn test_box() {
|
||||
fail_unless!((@10 == @10));
|
||||
assert!((@10 == @10));
|
||||
}
|
||||
|
||||
fn test_ptr() {
|
||||
|
|
@ -68,14 +68,14 @@ fn test_ptr() {
|
|||
let p2: *u8 = ::core::cast::reinterpret_cast(&0);
|
||||
let p3: *u8 = ::core::cast::reinterpret_cast(&1);
|
||||
|
||||
fail_unless!(p1 == p2);
|
||||
fail_unless!(p1 != p3);
|
||||
fail_unless!(p1 < p3);
|
||||
fail_unless!(p1 <= p3);
|
||||
fail_unless!(p3 > p1);
|
||||
fail_unless!(p3 >= p3);
|
||||
fail_unless!(p1 <= p2);
|
||||
fail_unless!(p1 >= p2);
|
||||
assert!(p1 == p2);
|
||||
assert!(p1 != p3);
|
||||
assert!(p1 < p3);
|
||||
assert!(p1 <= p3);
|
||||
assert!(p3 > p1);
|
||||
assert!(p3 >= p3);
|
||||
assert!(p1 <= p2);
|
||||
assert!(p1 >= p2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -110,11 +110,11 @@ fn test_class() {
|
|||
(::core::cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&q))),
|
||||
(::core::cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&r))));
|
||||
}
|
||||
fail_unless!((q == r));
|
||||
assert!((q == r));
|
||||
r.y = 17;
|
||||
fail_unless!((r.y != q.y));
|
||||
fail_unless!((r.y == 17));
|
||||
fail_unless!((q != r));
|
||||
assert!((r.y != q.y));
|
||||
assert!((r.y == 17));
|
||||
assert!((q != r));
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@
|
|||
|
||||
#[cfg(target_arch = "x86")]
|
||||
fn target() {
|
||||
fail_unless!((-1000 as uint >> 3u == 536870787u));
|
||||
assert!((-1000 as uint >> 3u == 536870787u));
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn target() {
|
||||
fail_unless!((-1000 as uint >> 3u == 2305843009213693827u));
|
||||
assert!((-1000 as uint >> 3u == 2305843009213693827u));
|
||||
}
|
||||
|
||||
fn general() {
|
||||
|
|
@ -28,14 +28,14 @@ fn general() {
|
|||
a = a ^ b;
|
||||
debug!(a);
|
||||
debug!(b);
|
||||
fail_unless!((b == 1));
|
||||
fail_unless!((a == 2));
|
||||
fail_unless!((!0xf0 & 0xff == 0xf));
|
||||
fail_unless!((0xf0 | 0xf == 0xff));
|
||||
fail_unless!((0xf << 4 == 0xf0));
|
||||
fail_unless!((0xf0 >> 4 == 0xf));
|
||||
fail_unless!((-16 >> 2 == -4));
|
||||
fail_unless!((0b1010_1010 | 0b0101_0101 == 0xff));
|
||||
assert!((b == 1));
|
||||
assert!((a == 2));
|
||||
assert!((!0xf0 & 0xff == 0xf));
|
||||
assert!((0xf0 | 0xf == 0xff));
|
||||
assert!((0xf << 4 == 0xf0));
|
||||
assert!((0xf0 >> 4 == 0xf));
|
||||
assert!((-16 >> 2 == -4));
|
||||
assert!((0b1010_1010 | 0b0101_0101 == 0xff));
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ fn asBlock( f : &fn()->uint ) -> uint {
|
|||
|
||||
pub fn main() {
|
||||
let x = asSendfn(|| 22u);
|
||||
fail_unless!((x == 22u));
|
||||
assert!((x == 22u));
|
||||
let x = asLambda(|| 22u);
|
||||
fail_unless!((x == 22u));
|
||||
assert!((x == 22u));
|
||||
let x = asBlock(|| 22u);
|
||||
fail_unless!((x == 22u));
|
||||
assert!((x == 22u));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,5 +14,5 @@ pub fn main() {
|
|||
// Trailing expressions don't require parentheses:
|
||||
let y = do vec::foldl(0f, v) |x, y| { x + *y } + 10f;
|
||||
|
||||
fail_unless!(y == 15f);
|
||||
assert!(y == 15f);
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue