blob: d53528515166e7868bd923119183001ea0a11851 (
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(); }
|