blob: 7d9e2320e9395266cd5b046996df43db4dd20ea4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// -*- rust -*-
// Tests for if as expressions returning boxed types
fn test_box() {
let rs = if true { @100 } else { @101 };
assert (*rs == 100);
}
fn test_str() {
let rs = if true { "happy" } else { "sad" };
assert (rs == "happy");
}
fn main() { test_box(); test_str(); }
|