]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/issue-14865.rs
7fa88a7653ac4179f91c185a828e88af5279526c
[rust.git] / src / test / run-pass / issue-14865.rs
1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 enum X {
12     Foo(uint),
13     Bar(bool)
14 }
15
16 fn main() {
17     let x = match Foo(42) {
18         Foo(..) => 1,
19         _ if true => 0,
20         Bar(..) => fail!("Oh dear")
21     };
22     assert_eq!(x, 1);
23
24     let x = match Foo(42) {
25         _ if true => 0,
26         Foo(..) => 1,
27         Bar(..) => fail!("Oh dear")
28     };
29     assert_eq!(x, 0);
30 }