Skip to content

Commit

Permalink
Some more typestate tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
graydon committed Jul 8, 2010
1 parent d397536 commit 115e14a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ TEST_XFAILS_LLVM := $(addprefix test/run-pass/, \
u8-incr.rs \
unit.rs \
user.rs \
use-uninit.rs \
utf8.rs \
vec-append.rs \
vec-concat.rs \
Expand Down
13 changes: 13 additions & 0 deletions src/test/compile-fail/use-uninit-2.rs
Original file line number Diff line number Diff line change
@@ -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);
}
15 changes: 15 additions & 0 deletions src/test/compile-fail/use-uninit-3.rs
Original file line number Diff line number Diff line change
@@ -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);
}
4 changes: 0 additions & 4 deletions src/test/compile-fail/use-uninit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@ fn foo(int x) {

fn main() {
let int x;
if (1 > 2) {
x = 10;
} else {
}
foo(x);
}
13 changes: 13 additions & 0 deletions src/test/run-pass/lazy-init.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
fn foo(int x) {
log x;
}

fn main() {
let int x;
if (1 > 2) {
x = 12;
} else {
x = 10;
}
foo(x);
}

0 comments on commit 115e14a

Please sign in to comment.