mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
Tweak some test cases and add a few new ones
This commit is contained in:
parent
eb9d0e89d1
commit
9838a7ec54
@ -1,7 +1,7 @@
|
||||
// error-pattern:mismatched types: expected `()` but found `bool`
|
||||
|
||||
fn main() {
|
||||
do {
|
||||
loop {
|
||||
true
|
||||
} while true;
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
// error-pattern:mismatched types: expected `()` but found `bool`
|
||||
|
||||
fn main() {
|
||||
loop {
|
||||
while true {
|
||||
true
|
||||
}
|
||||
}
|
@ -3,8 +3,8 @@ fn main() {
|
||||
|
||||
let y: int = 42;
|
||||
let x: int;
|
||||
do {
|
||||
loop {
|
||||
log(debug, y);
|
||||
do { do { do { x <- y; } while true } while true } while true
|
||||
} while true
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ pure fn even(y: int) -> bool { true }
|
||||
fn main() {
|
||||
let y: int = 42;
|
||||
check (even(y));
|
||||
do {
|
||||
loop {
|
||||
print_even(y);
|
||||
do { do { do { y += 1; } while false } while false } while false
|
||||
} while true
|
||||
}
|
||||
}
|
||||
|
6
src/test/compile-fail/unreachable-code.rs
Normal file
6
src/test/compile-fail/unreachable-code.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// error-pattern:unreachable statement
|
||||
fn main() {
|
||||
loop{}
|
||||
// red herring to make sure compilation fails
|
||||
log(error, 42 == 'c');
|
||||
}
|
7
src/test/run-pass/loop-break-cont-1.rs
Normal file
7
src/test/run-pass/loop-break-cont-1.rs
Normal file
@ -0,0 +1,7 @@
|
||||
fn main() {
|
||||
let i = 0u;
|
||||
loop {
|
||||
break;
|
||||
}
|
||||
assert true;
|
||||
}
|
40
src/test/run-pass/loop-break-cont.rs
Normal file
40
src/test/run-pass/loop-break-cont.rs
Normal file
@ -0,0 +1,40 @@
|
||||
// xfail-test
|
||||
// runs forever for some reason -- investigating
|
||||
fn main() {
|
||||
let i = 0u;
|
||||
loop {
|
||||
log(error, "a");
|
||||
i += 1u;
|
||||
if i == 10u {
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert (i == 10u);
|
||||
let is_even = false;
|
||||
loop {
|
||||
log(error, "b");
|
||||
is_even = false;
|
||||
i += 1u;
|
||||
if i % 2u != 0u {
|
||||
cont;
|
||||
}
|
||||
is_even = true;
|
||||
if i == 21u {
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert !is_even;
|
||||
loop {
|
||||
log(error, "c");
|
||||
is_even = false;
|
||||
if i == 22u {
|
||||
break;
|
||||
}
|
||||
i += 1u;
|
||||
if i % 2u != 0u {
|
||||
cont;
|
||||
}
|
||||
is_even = true;
|
||||
}
|
||||
assert is_even;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
// xfail-win32 leaks
|
||||
// Issue #787
|
||||
// Don't try to clean up uninitizaed locals
|
||||
// Don't try to clean up uninitialized locals
|
||||
|
||||
use std;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user