diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2011-06-28 11:48:54 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2011-06-28 11:49:11 -0700 |
| commit | 926049edddb6a990f22658205a2f3d467d0e4475 (patch) | |
| tree | ce07d8d619a993b05e5c9c282d584b44d7fe9a86 /src | |
| parent | 1ca0db5421c0737088112d55475d37bd7f3d0bb4 (diff) | |
Tests only: more tests with constraints and loops
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/compile-fail/do-while-pred-constraints.rs | 26 | ||||
| -rw-r--r-- | src/test/compile-fail/while-loop-pred-constraints.rs | 27 |
2 files changed, 53 insertions, 0 deletions
diff --git a/src/test/compile-fail/do-while-pred-constraints.rs b/src/test/compile-fail/do-while-pred-constraints.rs new file mode 100644 index 00000000000..77b1558efb2 --- /dev/null +++ b/src/test/compile-fail/do-while-pred-constraints.rs @@ -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); +} \ No newline at end of file diff --git a/src/test/compile-fail/while-loop-pred-constraints.rs b/src/test/compile-fail/while-loop-pred-constraints.rs new file mode 100644 index 00000000000..2304de6290b --- /dev/null +++ b/src/test/compile-fail/while-loop-pred-constraints.rs @@ -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; + } + } + } + } +} \ No newline at end of file |
