2012-12-10 17:32:48 -08:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
2014-07-21 15:57:14 -07:00
|
|
|
//
|
|
|
|
// ignore-lexer-test FIXME #15877
|
2012-12-10 17:32:48 -08:00
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2012-08-06 12:34:08 -07:00
|
|
|
match 5u {
|
2014-09-26 21:13:20 -07:00
|
|
|
1u...5u => {}
|
2013-10-21 13:08:31 -07:00
|
|
|
_ => fail!("should match range"),
|
2011-09-28 12:07:33 -07:00
|
|
|
}
|
2012-08-06 12:34:08 -07:00
|
|
|
match 5u {
|
2014-09-26 21:13:20 -07:00
|
|
|
6u...7u => fail!("shouldn't match range"),
|
2012-08-03 19:59:04 -07:00
|
|
|
_ => {}
|
2011-09-28 12:07:33 -07:00
|
|
|
}
|
2012-08-23 14:44:58 -07:00
|
|
|
match 5u {
|
2013-10-21 13:08:31 -07:00
|
|
|
1u => fail!("should match non-first range"),
|
2014-09-26 21:13:20 -07:00
|
|
|
2u...6u => {}
|
2013-10-21 13:08:31 -07:00
|
|
|
_ => fail!("math is broken")
|
2011-09-28 12:07:33 -07:00
|
|
|
}
|
2012-08-06 12:34:08 -07:00
|
|
|
match 'c' {
|
2014-09-26 21:13:20 -07:00
|
|
|
'a'...'z' => {}
|
2013-10-21 13:08:31 -07:00
|
|
|
_ => fail!("should suppport char ranges")
|
2011-09-28 12:07:33 -07:00
|
|
|
}
|
2014-06-27 12:30:25 -07:00
|
|
|
match -3i {
|
2014-09-26 21:13:20 -07:00
|
|
|
-7...5 => {}
|
2013-10-21 13:08:31 -07:00
|
|
|
_ => fail!("should match signed range")
|
2011-09-28 12:07:33 -07:00
|
|
|
}
|
2014-06-27 12:30:25 -07:00
|
|
|
match 3.0f64 {
|
2014-09-26 21:13:20 -07:00
|
|
|
1.0...5.0 => {}
|
2013-10-21 13:08:31 -07:00
|
|
|
_ => fail!("should match float range")
|
2011-09-28 12:07:33 -07:00
|
|
|
}
|
2014-06-27 12:30:25 -07:00
|
|
|
match -1.5f64 {
|
2014-09-26 21:13:20 -07:00
|
|
|
-3.6...3.6 => {}
|
2013-10-21 13:08:31 -07:00
|
|
|
_ => fail!("should match negative float range")
|
2011-09-28 12:07:33 -07:00
|
|
|
}
|
|
|
|
}
|