OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
siva
2016/09/23 14:47:32
2016
| |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import "package:expect/expect.dart"; | |
6 | |
7 main() { | |
8 var expect = new String.fromCharCodes([ | |
9 0, 0x0a, 0x0d, 0x7f, 0xff, 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff | |
10 ]); | |
11 test(string) { | |
12 Expect.equals(expect, string); | |
13 } | |
14 | |
15 // Plain escapes of code points. | |
16 test("\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}"); | |
17 test("""\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}"""); | |
18 test('\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}'); | |
19 test('''\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}'''); | |
20 // Plain escapes of individual code units. | |
21 test("\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff"); | |
22 test("""\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff"""); | |
23 test('\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff'); | |
24 test('''\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff'''); | |
25 // Insert newline into multiline string. | |
26 test("""\x00 | |
27 \x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff"""); | |
28 test('''\x00 | |
29 \x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff'''); | |
30 // Extract code points from multi-character escape string. | |
31 test("\x00\x0a\x0d\x7f\xff\uffff" | |
32 "${"\u{10000}"[0]}${"\u{10000}"[1]}" | |
33 "${"\u{10FFFF}"[0]}${"\u{10FFFF}"[1]}"); | |
34 test("\x00\x0a\x0d\x7f\xff\uffff" + | |
35 "\ud800" + "\udc00\udbff" + "\udfff"); | |
36 // Single line string over multiple lines with newlines inside interpolation. | |
37 test("\x00\x0a\x0d\x7f\xff${ | |
38 "" | |
39 }\uffff\ud800\udc00\udbff\udfff"); | |
40 } | |
OLD | NEW |