1 // Copyright 2014 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.
12 static FOO: u8 = b'\xF0';
13 static BAR: &'static [u8] = b"a\xF0\t";
14 static BAZ: &'static [u8] = br"a\n";
17 assert_eq!(b'a', 97u8);
18 assert_eq!(b'\n', 10u8);
19 assert_eq!(b'\r', 13u8);
20 assert_eq!(b'\t', 9u8);
21 assert_eq!(b'\\', 92u8);
22 assert_eq!(b'\'', 39u8);
23 assert_eq!(b'\"', 34u8);
24 assert_eq!(b'\0', 0u8);
25 assert_eq!(b'\xF0', 240u8);
26 assert_eq!(FOO, 240u8);
28 assert_eq!([42, ..b'\t'].as_slice(), &[42, 42, 42, 42, 42, 42, 42, 42, 42]);
40 assert_eq!(b"a\n\r\t\\\'\"\0\xF0",
41 &[97u8, 10u8, 13u8, 9u8, 92u8, 39u8, 34u8, 0u8, 240u8]);
44 assert_eq!(BAR, &[97u8, 240u8, 9u8]);
51 assert_eq!(BAZ, &[97u8, 92u8, 110u8]);
52 assert_eq!(br"a\n", &[97u8, 92u8, 110u8]);
53 assert_eq!(br"a\n", b"a\\n");
54 assert_eq!(br###"a"##b"###, &[97u8, 34u8, 35u8, 35u8, 98u8]);
55 assert_eq!(br###"a"##b"###, b"a\"##b");