diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-03-06 13:58:02 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-03-07 22:37:57 -0800 |
| commit | d7e74b5e91b0b6b6a5613f54479d2ef9fe9c392f (patch) | |
| tree | b1ce2f5b126be2790aad28ac0c0e526979d91e49 /doc/tutorial.md | |
| parent | 0ea031bcb8c237365b8bf15ae474972570cf15f9 (diff) | |
| download | rust-d7e74b5e91b0b6b6a5613f54479d2ef9fe9c392f.tar.gz rust-d7e74b5e91b0b6b6a5613f54479d2ef9fe9c392f.zip | |
librustc: Convert all uses of `assert` over to `fail_unless!`
Diffstat (limited to 'doc/tutorial.md')
| -rw-r--r-- | doc/tutorial.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/tutorial.md b/doc/tutorial.md index b1eceeab70e..79553d5aa6e 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -381,7 +381,7 @@ expression to the given type. ~~~~ let x: float = 4.0; let y: uint = x as uint; -assert y == 4u; +fail_unless!(y == 4u); ~~~~ ## Syntax extensions @@ -849,8 +849,8 @@ Ending the function with a semicolon like so is equivalent to returning `()`. fn line(a: int, b: int, x: int) -> int { a * x + b } fn oops(a: int, b: int, x: int) -> () { a * x + b; } -assert 8 == line(5, 3, 1); -assert () == oops(5, 3, 1); +fail_unless!(8 == line(5, 3, 1)); +fail_unless!(() == oops(5, 3, 1)); ~~~~ As with `match` expressions and `let` bindings, function arguments support @@ -1000,7 +1000,7 @@ let x = ~10; let y = copy x; let z = *x + *y; -assert z == 20; +fail_unless!(z == 20); ~~~~ When they do not contain any managed boxes, owned boxes can be sent @@ -1327,8 +1327,8 @@ and [`core::str`]. Here are some examples. let crayons = [Almond, AntiqueBrass, Apricot]; // Check the length of the vector -assert crayons.len() == 3; -assert !crayons.is_empty(); +fail_unless!(crayons.len() == 3); +fail_unless!(!crayons.is_empty()); // Iterate over a vector, obtaining a pointer to each element for crayons.each |crayon| { |
