Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: tests/language/string_literals_test.dart

Issue 2304923002: Allow surrogates in string literals. (Closed)
Patch Set: Fixed another test Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/co19/co19-co19.status ('k') | tests/language/string_unicode4_negative_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « tests/co19/co19-co19.status ('k') | tests/language/string_unicode4_negative_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698