diff options
| author | Graydon Hoare <[email protected]> | 2010-07-08 07:33:25 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-07-08 07:33:25 -0700 |
| commit | 115e14a32c1940a4868ae8633039a296450740ea (patch) | |
| tree | 086b00f13564d4c4927d79acf390a8ac3f505fb3 /src/test/compile-fail | |
| parent | Doc tweak. (diff) | |
| download | rust-115e14a32c1940a4868ae8633039a296450740ea.tar.xz rust-115e14a32c1940a4868ae8633039a296450740ea.zip | |
Some more typestate tests.
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/use-uninit-2.rs | 13 | ||||
| -rw-r--r-- | src/test/compile-fail/use-uninit-3.rs | 15 | ||||
| -rw-r--r-- | src/test/compile-fail/use-uninit.rs | 4 |
3 files changed, 28 insertions, 4 deletions
diff --git a/src/test/compile-fail/use-uninit-2.rs b/src/test/compile-fail/use-uninit-2.rs new file mode 100644 index 00000000..79cebe28 --- /dev/null +++ b/src/test/compile-fail/use-uninit-2.rs @@ -0,0 +1,13 @@ +// error-pattern:Unsatisfied precondition + +fn foo(int x) { + log x; +} + +fn main() { + let int x; + if (1 > 2) { + x = 10; + } + foo(x); +}
\ No newline at end of file diff --git a/src/test/compile-fail/use-uninit-3.rs b/src/test/compile-fail/use-uninit-3.rs new file mode 100644 index 00000000..e6545451 --- /dev/null +++ b/src/test/compile-fail/use-uninit-3.rs @@ -0,0 +1,15 @@ +// error-pattern:Unsatisfied precondition + +fn foo(int x) { + log x; +} + +fn main() { + let int x; + if (1 > 2) { + log "whoops"; + } else { + x = 10; + } + foo(x); +}
\ No newline at end of file diff --git a/src/test/compile-fail/use-uninit.rs b/src/test/compile-fail/use-uninit.rs index 5790bfbd..03dafdcc 100644 --- a/src/test/compile-fail/use-uninit.rs +++ b/src/test/compile-fail/use-uninit.rs @@ -6,9 +6,5 @@ fn foo(int x) { fn main() { let int x; - if (1 > 2) { - x = 10; - } else { - } foo(x); }
\ No newline at end of file |