Tests only: more tests with constraints and loops
This commit is contained in:
parent
1ca0db5421
commit
926049eddd
2 changed files with 53 additions and 0 deletions
26
src/test/compile-fail/do-while-pred-constraints.rs
Normal file
26
src/test/compile-fail/do-while-pred-constraints.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// xfail-stage0
|
||||
// error-pattern: Unsatisfied precondition constraint (for example, even(y
|
||||
|
||||
fn print_even(int y) : even(y) {
|
||||
log y;
|
||||
}
|
||||
|
||||
pred even(int y) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
let int y = 42;
|
||||
check even(y);
|
||||
do {
|
||||
print_even(y);
|
||||
do {
|
||||
do {
|
||||
do {
|
||||
y += 1;
|
||||
} while (true);
|
||||
} while (true);
|
||||
} while (true);
|
||||
} while (true);
|
||||
}
|
||||
27
src/test/compile-fail/while-loop-pred-constraints.rs
Normal file
27
src/test/compile-fail/while-loop-pred-constraints.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// xfail-stage0
|
||||
// error-pattern: Unsatisfied precondition constraint (for example, even(y
|
||||
|
||||
fn print_even(int y) : even(y) {
|
||||
log y;
|
||||
}
|
||||
|
||||
pred even(int y) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
let int y = 42;
|
||||
let int x = 1;
|
||||
check even(y);
|
||||
while (true) {
|
||||
print_even(y);
|
||||
while (true) {
|
||||
while (true) {
|
||||
while (true) {
|
||||
y += x;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue