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.
11 // ignore-lexer-test FIXME #15883
14 static FOO: u8 = b'\xF0';
15 static BAR: &'static [u8] = b"a\xF0\t";
16 static BAZ: &'static [u8] = br"a\n";
19 assert_eq!(b'a', 97u8);
20 assert_eq!(b'\n', 10u8);
21 assert_eq!(b'\r', 13u8);
22 assert_eq!(b'\t', 9u8);
23 assert_eq!(b'\\', 92u8);
24 assert_eq!(b'\'', 39u8);
25 assert_eq!(b'\"', 34u8);
26 assert_eq!(b'\0', 0u8);
27 assert_eq!(b'\xF0', 240u8);
28 assert_eq!(FOO, 240u8);
40 let expected: &[_] = &[97u8, 10u8, 13u8, 9u8, 92u8, 39u8, 34u8, 0u8, 240u8];
41 assert_eq!(b"a\n\r\t\\\'\"\0\xF0", expected);
42 let expected: &[_] = &[97u8, 98u8];
45 let expected: &[_] = &[97u8, 240u8, 9u8];
46 assert_eq!(BAR, expected);
48 let val: &[_] = &[97u8, 10u8];
54 let buf = vec!(97u8, 98, 99, 100);
55 assert_eq!(match buf.slice(0, 3) {
61 let expected: &[_] = &[97u8, 92u8, 110u8];
62 assert_eq!(BAZ, expected);
63 let expected: &[_] = &[97u8, 92u8, 110u8];
64 assert_eq!(br"a\n", expected);
65 assert_eq!(br"a\n", b"a\\n");
66 let expected: &[_] = &[97u8, 34u8, 35u8, 35u8, 98u8];
67 assert_eq!(br###"a"##b"###, expected);
68 assert_eq!(br###"a"##b"###, b"a\"##b");