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