]> git.proxmox.com Git - rustc.git/blob - src/test/ui/expr/if/expr-if-panic-pass.rs
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / test / ui / expr / if / expr-if-panic-pass.rs
1 // run-pass
2
3 fn test_if_panic() {
4 let x = if false { panic!() } else { 10 };
5 assert_eq!(x, 10);
6 }
7
8 fn test_else_panic() {
9 let x = if true { 10 } else { panic!() };
10 assert_eq!(x, 10);
11 }
12
13 fn test_elseif_panic() {
14 let x = if false { 0 } else if false { panic!() } else { 10 };
15 assert_eq!(x, 10);
16 }
17
18 pub fn main() { test_if_panic(); test_else_panic(); test_elseif_panic(); }