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

http://github.com/jruderman/rust · Rust · 21 lines · 13 code · 7 blank · 1 comment · 5 complexity · 579bd4524d316d4dbf63712c73f37c31 MD5 · raw file

  1. // Issue #53
  2. fn main() {
  3. match check ~"test" { ~"not-test" => fail, ~"test" => (), _ => fail }
  4. enum t { tag1(~str), tag2, }
  5. match tag1(~"test") {
  6. tag2 => fail,
  7. tag1(~"not-test") => fail,
  8. tag1(~"test") => (),
  9. _ => fail
  10. }
  11. let x = match check ~"a" { ~"a" => 1, ~"b" => 2 };
  12. assert (x == 1);
  13. match check ~"a" { ~"a" => { } ~"b" => { } }
  14. }