]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/match-range.rs
auto merge of #17654 : gereeter/rust/no-unnecessary-cell, r=alexcrichton
[rust.git] / src / test / run-pass / match-range.rs
1 // Copyright 2012 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 // ignore-lexer-test FIXME #15877
12
13 pub fn main() {
14     match 5u {
15       1u...5u => {}
16       _ => fail!("should match range"),
17     }
18     match 5u {
19       6u...7u => fail!("shouldn't match range"),
20       _ => {}
21     }
22     match 5u {
23       1u => fail!("should match non-first range"),
24       2u...6u => {}
25       _ => fail!("math is broken")
26     }
27     match 'c' {
28       'a'...'z' => {}
29       _ => fail!("should suppport char ranges")
30     }
31     match -3i {
32       -7...5 => {}
33       _ => fail!("should match signed range")
34     }
35     match 3.0f64 {
36       1.0...5.0 => {}
37       _ => fail!("should match float range")
38     }
39     match -1.5f64 {
40       -3.6...3.6 => {}
41       _ => fail!("should match negative float range")
42     }
43 }