PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/jruderman/rust
Rust | 13 lines | 10 code | 3 blank | 0 comment | 11 complexity | 813dd72d41814c4d242745386e5869bd MD5 | raw file
 1fn test_if_fail() { let x = if false { fail } else { 10 }; assert (x == 10); }
 2
 3fn test_else_fail() {
 4    let x = if true { 10 } else { fail };
 5    assert (x == 10);
 6}
 7
 8fn test_elseif_fail() {
 9    let x = if false { 0 } else if false { fail } else { 10 };
10    assert (x == 10);
11}
12
13fn main() { test_if_fail(); test_else_fail(); test_elseif_fail(); }