]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/estr-slice.rs
New upstream version 1.19.0+dfsg1
[rustc.git] / src / test / run-pass / estr-slice.rs
CommitLineData
223e47cc
LB
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
12pub fn main() {
1a4d82fc
JJ
13 let x = "hello";
14 let v = "hello";
15 let y : &str = "there";
223e47cc 16
1a4d82fc
JJ
17 println!("{}", x);
18 println!("{}", y);
223e47cc 19
1a4d82fc
JJ
20 assert_eq!(x.as_bytes()[0], 'h' as u8);
21 assert_eq!(x.as_bytes()[4], 'o' as u8);
223e47cc 22
1a4d82fc 23 let z : &str = "thing";
970d7e83 24 assert_eq!(v, x);
223e47cc
LB
25 assert!(x != z);
26
1a4d82fc
JJ
27 let a = "aaaa";
28 let b = "bbbb";
223e47cc 29
1a4d82fc
JJ
30 let c = "cccc";
31 let cc = "ccccc";
223e47cc 32
1a4d82fc 33 println!("{}", a);
223e47cc
LB
34
35 assert!(a < b);
36 assert!(a <= b);
37 assert!(a != b);
38 assert!(b >= a);
39 assert!(b > a);
40
1a4d82fc 41 println!("{}", b);
223e47cc
LB
42
43 assert!(a < c);
44 assert!(a <= c);
45 assert!(a != c);
46 assert!(c >= a);
47 assert!(c > a);
48
1a4d82fc 49 println!("{}", c);
223e47cc
LB
50
51 assert!(c < cc);
52 assert!(c <= cc);
53 assert!(c != cc);
54 assert!(cc >= c);
55 assert!(cc > c);
56
1a4d82fc 57 println!("{}", cc);
223e47cc 58}