Test cases for pred / check stuff
This commit is contained in:
parent
e3a68e235c
commit
acf9bd7909
17
src/test/compile-fail/impure-pred.rs
Normal file
17
src/test/compile-fail/impure-pred.rs
Normal 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);
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
// -*- rust -*-
|
||||
// xfail-boot
|
||||
// xfail-stage0
|
||||
|
||||
// error-pattern: non-predicate
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
// -*- rust -*-
|
||||
// xfail-boot
|
||||
// xfail-stage0
|
||||
|
||||
// error-pattern: expected the constraint name
|
||||
|
||||
|
12
src/test/compile-fail/not-a-pred-check.rs
Normal file
12
src/test/compile-fail/not-a-pred-check.rs
Normal 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);
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
// -*- rust -*-
|
||||
// xfail-boot
|
||||
// xfail-stage0
|
||||
|
||||
// error-pattern: Constraint args must be
|
||||
|
||||
|
13
src/test/compile-fail/pred-not-bool.rs
Normal file
13
src/test/compile-fail/pred-not-bool.rs
Normal 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() {
|
||||
}
|
11
src/test/run-pass/pred-check.rs
Normal file
11
src/test/run-pass/pred-check.rs
Normal 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);
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user