PageRenderTime 12ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/src/test/run-pass/alt-str.rs

http://github.com/jruderman/rust
Rust | 21 lines | 13 code | 7 blank | 1 comment | 1 complexity | 579bd4524d316d4dbf63712c73f37c31 MD5 | raw file
 1// Issue #53
 2
 3fn main() {
 4    match check ~"test" { ~"not-test" => fail, ~"test" => (), _ => fail }
 5
 6    enum t { tag1(~str), tag2, }
 7
 8
 9    match tag1(~"test") {
10      tag2 => fail,
11      tag1(~"not-test") => fail,
12      tag1(~"test") => (),
13      _ => fail
14    }
15
16    let x = match check ~"a" { ~"a" => 1, ~"b" => 2 };
17    assert (x == 1);
18
19    match check ~"a" { ~"a" => { } ~"b" => { } }
20
21}