Tweak some test cases and add a few new ones

This commit is contained in:
Tim Chevalier 2012-03-10 20:38:03 -08:00
parent eb9d0e89d1
commit 9838a7ec54
8 changed files with 61 additions and 8 deletions

View File

@ -1,7 +1,7 @@
// error-pattern:mismatched types: expected `()` but found `bool`
fn main() {
do {
loop {
true
} while true;
}
}

View File

@ -1,7 +1,7 @@
// error-pattern:mismatched types: expected `()` but found `bool`
fn main() {
loop {
while true {
true
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -0,0 +1,6 @@
// error-pattern:unreachable statement
fn main() {
loop{}
// red herring to make sure compilation fails
log(error, 42 == 'c');
}

View File

@ -0,0 +1,7 @@
fn main() {
let i = 0u;
loop {
break;
}
assert true;
}

View 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;
}

View File

@ -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;