2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2013-01-04 01:22:56 -08:00
|
|
|
enum Foo {
|
|
|
|
Bar(u32),
|
|
|
|
Baz,
|
|
|
|
Quux(u64, u16)
|
|
|
|
}
|
|
|
|
|
2014-11-06 00:05:53 -08:00
|
|
|
static X: Foo = Foo::Baz;
|
2013-01-04 01:22:56 -08:00
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2013-01-04 01:22:56 -08:00
|
|
|
match X {
|
2014-11-06 00:05:53 -08:00
|
|
|
Foo::Baz => {}
|
2014-10-09 15:17:22 -04:00
|
|
|
_ => panic!()
|
2013-01-04 01:22:56 -08:00
|
|
|
}
|
|
|
|
match Y {
|
2015-06-07 21:00:38 +03:00
|
|
|
Foo::Bar(s) => assert_eq!(s, 2654435769),
|
2014-10-09 15:17:22 -04:00
|
|
|
_ => panic!()
|
2013-01-04 01:22:56 -08:00
|
|
|
}
|
|
|
|
match Z {
|
2014-11-06 00:05:53 -08:00
|
|
|
Foo::Quux(d,h) => {
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(d, 0x123456789abcdef0);
|
|
|
|
assert_eq!(h, 0x1234);
|
2013-01-04 01:22:56 -08:00
|
|
|
}
|
2014-10-09 15:17:22 -04:00
|
|
|
_ => panic!()
|
2013-01-04 01:22:56 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-06 00:05:53 -08:00
|
|
|
static Y: Foo = Foo::Bar(2654435769);
|
|
|
|
static Z: Foo = Foo::Quux(0x123456789abcdef0, 0x1234);
|