From 926049edddb6a990f22658205a2f3d467d0e4475 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Tue, 28 Jun 2011 11:48:54 -0700 Subject: [PATCH] Tests only: more tests with constraints and loops --- .../compile-fail/do-while-pred-constraints.rs | 26 ++++++++++++++++++ .../while-loop-pred-constraints.rs | 27 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 src/test/compile-fail/do-while-pred-constraints.rs create mode 100644 src/test/compile-fail/while-loop-pred-constraints.rs 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 000000000000..77b1558efb29 --- /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 000000000000..2304de6290b8 --- /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