rust/src/test/run-pass/or-pattern.rs
Brian Anderson 518dc52f85 Reformat
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00

12 lines
272 B
Rust

tag blah { a(int, int, uint); b(int, int); c; }
fn or_alt(q: &blah) -> int {
alt q { a(x, y, _) | b(x, y) { ret x + y; } c. { ret 0; } }
}
fn main() {
assert (or_alt(c) == 0);
assert (or_alt(a(10, 100, 0u)) == 110);
assert (or_alt(b(20, 200)) == 220);
}