]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/issue-13867.rs
rustdoc: Replace no-pretty-expanded with pretty-expanded
[rust.git] / src / test / run-pass / issue-13867.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 // Test that codegen works correctly when there are multiple refutable
12 // patterns in match expression.
13
14 // pretty-expanded FIXME #23616
15
16 enum Foo {
17     FooUint(uint),
18     FooNullary,
19 }
20
21 fn main() {
22     let r = match (Foo::FooNullary, 'a') {
23         (Foo::FooUint(..), 'a'...'z') => 1,
24         (Foo::FooNullary, 'x') => 2,
25         _ => 0
26     };
27     assert_eq!(r, 0);
28
29     let r = match (Foo::FooUint(0), 'a') {
30         (Foo::FooUint(1), 'a'...'z') => 1,
31         (Foo::FooUint(..), 'x') => 2,
32         (Foo::FooNullary, 'a') => 3,
33         _ => 0
34     };
35     assert_eq!(r, 0);
36
37     let r = match ('a', Foo::FooUint(0)) {
38         ('a'...'z', Foo::FooUint(1)) => 1,
39         ('x', Foo::FooUint(..)) => 2,
40         ('a', Foo::FooNullary) => 3,
41         _ => 0
42     };
43     assert_eq!(r, 0);
44
45     let r = match ('a', 'a') {
46         ('a'...'z', 'b') => 1,
47         ('x', 'a'...'z') => 2,
48         _ => 0
49     };
50     assert_eq!(r, 0);
51
52     let r = match ('a', 'a') {
53         ('a'...'z', 'b') => 1,
54         ('x', 'a'...'z') => 2,
55         ('a', 'a') => 3,
56         _ => 0
57     };
58     assert_eq!(r, 3);
59 }