]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/estr-slice.rs
auto merge of #7831 : ozten/rust/issues-7764-swap_unwarp-take-unwrap, r=pcwalton
[rust.git] / src / test / run-pass / estr-slice.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
12 pub fn main() {
13     let x = &"hello";
14     let v = &"hello";
15     let mut y : &str = &"there";
16
17     info!(x);
18     info!(y);
19
20     assert_eq!(x[0], 'h' as u8);
21     assert_eq!(x[4], 'o' as u8);
22
23     let z : &str = &"thing";
24     assert_eq!(v, x);
25     assert!(x != z);
26
27     let a = &"aaaa";
28     let b = &"bbbb";
29
30     let c = &"cccc";
31     let cc = &"ccccc";
32
33     info!(a);
34
35     assert!(a < b);
36     assert!(a <= b);
37     assert!(a != b);
38     assert!(b >= a);
39     assert!(b > a);
40
41     info!(b);
42
43     assert!(a < c);
44     assert!(a <= c);
45     assert!(a != c);
46     assert!(c >= a);
47     assert!(c > a);
48
49     info!(c);
50
51     assert!(c < cc);
52     assert!(c <= cc);
53     assert!(c != cc);
54     assert!(cc >= c);
55     assert!(cc > c);
56
57     info!(cc);
58 }