summary refs log tree commit diff
path: root/src/test/run-pass/expr-alt-box.rs
blob: 8fe7a4e4bc1d7f4b603bd54615e168da58508afa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



// -*- rust -*-

// Tests for match as expressions resulting in boxed types
fn test_box() {
    let res = match true { true => { @100 } _ => fail ~"wat" };
    assert (*res == 100);
}

fn test_str() {
    let res = match true { true => { ~"happy" },
                         _ => fail ~"not happy at all" };
    assert (res == ~"happy");
}

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