rust/src/test/run-pass/expr-if-fail.rs

14 lines
349 B
Rust
Raw Normal View History

2011-07-27 07:19:39 -05:00
fn test_if_fail() { let x = if false { fail } else { 10 }; assert (x == 10); }
2011-05-21 13:07:44 -05:00
fn test_else_fail() {
2011-07-27 07:19:39 -05:00
let x = if true { 10 } else { fail };
assert (x == 10);
2011-05-21 13:07:44 -05:00
}
fn test_elseif_fail() {
let x = if false { 0 } else if false { fail } else { 10 };
assert (x == 10);
2011-05-21 13:07:44 -05:00
}
fn main() { test_if_fail(); test_else_fail(); test_elseif_fail(); }