aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/expr-if-box.rs
blob: 30dce957235b28eb6df974b28c0ffe4255aecd1f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// xfail-boot
// xfail-stage0
// -*- rust -*-

// Tests for if as expressions returning boxed types

fn test_box() {
  auto res = if (true) { @100 } else { @101 };
  check (*res == 100);
}

fn test_str() {
  auto res = if (true) { "happy" } else { "sad" };
  check (res == "happy");
}

fn main() {
  test_box();
  test_str();
}