mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-21 19:33:16 +00:00
Some more typestate tests.
This commit is contained in:
parent
d39753685b
commit
115e14a32c
@ -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 \
|
||||
|
13
src/test/compile-fail/use-uninit-2.rs
Normal file
13
src/test/compile-fail/use-uninit-2.rs
Normal file
@ -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
src/test/compile-fail/use-uninit-3.rs
Normal file
15
src/test/compile-fail/use-uninit-3.rs
Normal file
@ -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);
|
||||
}
|
@ -6,9 +6,5 @@ fn foo(int x) {
|
||||
|
||||
fn main() {
|
||||
let int x;
|
||||
if (1 > 2) {
|
||||
x = 10;
|
||||
} else {
|
||||
}
|
||||
foo(x);
|
||||
}
|
13
src/test/run-pass/lazy-init.rs
Normal file
13
src/test/run-pass/lazy-init.rs
Normal file
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user