]> git.lizzy.rs Git - rust.git/blob - src/test/ui/binding/match-str.rs
Auto merge of #99612 - yanchen4791:issue-95079-fix, r=compiler-errors
[rust.git] / src / test / ui / binding / match-str.rs
1 // run-pass
2 #![allow(dead_code)]
3 // Issue #53
4 #![allow(non_camel_case_types)]
5
6
7 pub fn main() {
8     match "test" { "not-test" => panic!(), "test" => (), _ => panic!() }
9
10     enum t { tag1(String), tag2, }
11
12
13     match t::tag1("test".to_string()) {
14       t::tag2 => panic!(),
15       t::tag1(ref s) if "test" != &**s => panic!(),
16       t::tag1(ref s) if "test" == &**s => (),
17       _ => panic!()
18     }
19
20     let x = match "a" { "a" => 1, "b" => 2, _ => panic!() };
21     assert_eq!(x, 1);
22
23     match "a" { "a" => { } "b" => { }, _ => panic!() }
24
25 }