rust/src/test/run-pass/box-pattern.rs

10 lines
216 B
Rust
Raw Normal View History

2011-07-27 07:19:39 -05:00
type foo = {a: int, b: uint};
enum bar { u(@foo), w(int), }
fn main() {
2012-08-06 14:34:08 -05:00
assert (match u(@{a: 10, b: 40u}) {
2012-08-03 21:59:04 -05:00
u(@{a: a, b: b}) => { a + (b as int) }
_ => { 66 }
2011-07-27 07:19:39 -05:00
} == 50);
}