1 // Copyright 2015 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.
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.
11 // Test that the precedence of ranges is correct
20 fn bar(&self) -> usize { 5 }
25 assert_eq!(x, (4..9));
28 assert_eq!(x, (1..9));
31 assert_eq!(x, (4..4));
33 let a = Foo { foo: 3 };
34 let x = a.foo..a.bar();
35 assert_eq!(x, (3..5));
42 let a = &[0, 1, 2, 3, 4, 5, 6];
44 assert_eq!(x, &a[2..4]);
46 assert_eq!(x, &a[..3]);
48 assert_eq!(x, &a[3..]);
50 for _i in 2+4..10-3 {}
54 for _ in 1.. { break; }
57 assert_eq!(x, (([1])..([2])));