2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(dead_code)]
|
2011-06-23 05:05:11 +00:00
|
|
|
// Issue #53
|
2018-08-31 13:02:01 +00:00
|
|
|
#![allow(non_camel_case_types)]
|
2011-06-23 05:05:11 +00:00
|
|
|
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2014-10-09 19:17:22 +00:00
|
|
|
match "test" { "not-test" => panic!(), "test" => (), _ => panic!() }
|
2011-06-23 05:05:11 +00:00
|
|
|
|
2014-05-22 23:57:53 +00:00
|
|
|
enum t { tag1(String), tag2, }
|
2011-06-23 05:05:11 +00:00
|
|
|
|
2011-07-27 12:19:39 +00:00
|
|
|
|
2014-11-06 08:05:53 +00:00
|
|
|
match t::tag1("test".to_string()) {
|
|
|
|
t::tag2 => panic!(),
|
2015-02-02 02:53:25 +00:00
|
|
|
t::tag1(ref s) if "test" != &**s => panic!(),
|
|
|
|
t::tag1(ref s) if "test" == &**s => (),
|
2014-10-09 19:17:22 +00:00
|
|
|
_ => panic!()
|
2011-07-27 12:19:39 +00:00
|
|
|
}
|
2011-09-01 05:34:41 +00:00
|
|
|
|
2015-01-25 21:05:03 +00:00
|
|
|
let x = match "a" { "a" => 1, "b" => 2, _ => panic!() };
|
2013-05-19 02:02:45 +00:00
|
|
|
assert_eq!(x, 1);
|
2011-09-01 05:34:41 +00:00
|
|
|
|
2014-10-09 19:17:22 +00:00
|
|
|
match "a" { "a" => { } "b" => { }, _ => panic!() }
|
2011-09-01 05:34:41 +00:00
|
|
|
|
2011-08-19 22:16:48 +00:00
|
|
|
}
|