Test cases for pred / check stuff

This commit is contained in:
Tim Chevalier 2011-05-04 11:32:06 -07:00 committed by Graydon Hoare
parent e3a68e235c
commit acf9bd7909
8 changed files with 57 additions and 3 deletions

View File

@ -0,0 +1,17 @@
// -*- rust -*-
// xfail-boot
// xfail-stage0
// error-pattern: impure function
fn g() -> () {}
pred f(int q) -> bool {
g();
ret true;
}
fn main() {
auto x = 0;
check f(x);
}

View File

@ -1,5 +1,6 @@
// -*- rust -*-
// xfail-boot
// xfail-stage0
// error-pattern: non-predicate

View File

@ -1,5 +1,6 @@
// -*- rust -*-
// xfail-boot
// xfail-stage0
// error-pattern: expected the constraint name

View File

@ -0,0 +1,12 @@
// -*- rust -*-
// xfail-boot
// xfail-stage0
// error-pattern: non-predicate
fn f(int q) -> bool { ret true; }
fn main() {
auto x = 0;
check f(x);
}

View File

@ -1,5 +1,6 @@
// -*- rust -*-
// xfail-boot
// xfail-stage0
// error-pattern: Constraint args must be

View File

@ -0,0 +1,13 @@
// -*- rust -*-
// error-pattern: mismatched types
// this checks that a pred with a non-bool return
// type is rejected, even if the pred is never used
pred bad(int a) -> int {
ret 37;
}
fn main() {
}

View File

@ -0,0 +1,11 @@
// -*- rust -*-
// xfail-boot
// xfail-stage0
pred f(int q) -> bool { ret true; }
fn main() {
auto x = 0;
check f(x);
}

View File

@ -1,12 +1,10 @@
// xfail-stage0
// xfail-stage1
// xfail-stage2
// -*- rust -*-
fn f(int a, int b) : lt(a,b) {
}
fn lt(int a, int b) -> bool {
pred lt(int a, int b) -> bool {
ret a < b;
}