rust/src/test/run-pass/guards-not-exhaustive.rs
2013-03-29 16:39:08 -07:00

14 lines
184 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!(xyzzy(R(Some(5))) == 0);
}