rust/src/test/run-pass/guards-not-exhaustive.rs
2013-05-19 08:16:02 -04:00

14 lines
185 B
Rust

enum Q { R(Option<uint>) }
fn xyzzy(q: Q) -> uint {
match q {
R(S) if S.is_some() => { 0 }
_ => 1
}
}
pub fn main() {
assert_eq!(xyzzy(R(Some(5))), 0);
}