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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/string_literals_test.dart
diff --git a/tests/language/string_literals_test.dart b/tests/language/string_literals_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..185661cd9006d462cc342899f571c5798578c92e
--- /dev/null
+++ b/tests/language/string_literals_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
siva 2016/09/23 14:47:32 2016
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+main() {
+ var expect = new String.fromCharCodes([
+ 0, 0x0a, 0x0d, 0x7f, 0xff, 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff
+ ]);
+ test(string) {
+ Expect.equals(expect, string);
+ }
+
+ // Plain escapes of code points.
+ test("\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}");
+ test("""\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}""");
+ test('\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}');
+ test('''\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}''');
+ // Plain escapes of individual code units.
+ test("\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff");
+ test("""\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff""");
+ test('\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff');
+ test('''\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff''');
+ // Insert newline into multiline string.
+ test("""\x00
+\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff""");
+ test('''\x00
+\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff''');
+ // Extract code points from multi-character escape string.
+ test("\x00\x0a\x0d\x7f\xff\uffff"
+ "${"\u{10000}"[0]}${"\u{10000}"[1]}"
+ "${"\u{10FFFF}"[0]}${"\u{10FFFF}"[1]}");
+ test("\x00\x0a\x0d\x7f\xff\uffff" +
+ "\ud800" + "\udc00\udbff" + "\udfff");
+ // Single line string over multiple lines with newlines inside interpolation.
+ test("\x00\x0a\x0d\x7f\xff${
+ ""
+ }\uffff\ud800\udc00\udbff\udfff");
+}
« 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