1 // Copyright 2013 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 // pretty-expanded FIXME #23616
15 let all_nuls1 = "\0\x00\u{0}\u{0}";
16 let all_nuls2 = "\u{0}\u{0}\x00\0";
17 let all_nuls3 = "\u{0}\u{0}\x00\0";
18 let all_nuls4 = "\x00\u{0}\0\u{0}";
20 // sizes for two should suffice
21 assert_eq!(all_nuls1.len(), 4);
22 assert_eq!(all_nuls2.len(), 4);
24 // string equality should pass between the strings
25 assert_eq!(all_nuls1, all_nuls2);
26 assert_eq!(all_nuls2, all_nuls3);
27 assert_eq!(all_nuls3, all_nuls4);
29 // all extracted characters in all_nuls are equivalent to each other
30 for c1 in all_nuls1.chars()
32 for c2 in all_nuls1.chars()
38 // testing equality between explicit character literals
39 assert_eq!('\0', '\x00');
40 assert_eq!('\u{0}', '\x00');
41 assert_eq!('\u{0}', '\u{0}');
43 // NUL characters should make a difference
44 assert!("Hello World" != "Hello \0World");
45 assert!("Hello World" != "Hello World\0");