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

Unified Diff: test/cctest/test-parsing.cc

Issue 706263002: Implement ES6 unicode escapes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 6 years, 1 month 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 | « src/scanner.cc ('k') | test/mjsunit/es6/unicode-escapes.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 79d76546e90b117404d191bcf59bfa2f33ec5c20..ee6adfee73523bc45c9d3860c434b80a40779fcd 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -4305,6 +4305,48 @@ TEST(InvalidUnicodeEscapes) {
// No escapes allowed in regexp flags
"/regex/\\u0069g",
"/regex/\\u006g",
+ "/regex/\\u{0069}g",
+ "/regex/\\u{69}g",
+ "/regex/\\u{00000069}g",
+ // Braces gone wrong
+ "var foob\\u{c481r = 0;",
+ "var foob\\uc481}r = 0;",
+ "var \\u{0052oo = 0;",
+ "var \\u0052}oo = 0;",
+ "\"foob\\u{c481r\"",
NULL};
RunParserSyncTest(context_data, data, kError);
}
+
+
+TEST(UnicodeEscapes) {
+ const char* context_data[][2] = {{"", ""},
+ {"'use strict';", ""},
+ {NULL, NULL}};
+ const char* data[] = {
+ // Identifier starting with escape
+ "var \\u0052oo = 0;",
+ "var \\u{0052}oo = 0;",
+ "var \\u{52}oo = 0;",
+ "var \\u{00000000052}oo = 0;",
+ // Identifier with an escape but not starting with an escape
+ "var foob\\uc481r = 0;",
+ "var foob\\u{c481}r = 0;",
+ // String with an escape
+ "\"foob\\uc481r\"",
+ "\"foob\\{uc481}r\"",
+ // Regexp body
+ "/(\\u0066|\\u0062)oo/",
+ "/(\\u{0066}|\\u{0062})oo/",
+ "/[\\u0062-\\u0066]oo/",
+ "/[\\u{0062}-\\u{0066}]oo/",
+ // If the { cannot be matched, the escape is only \u and the rest is
+ // not part of the escape.
+ "/(\\u{0066|\\u{0062)oo/",
+ "/[\\u{0062-\\u{0066 ]oo/",
+ // This character is a valid unicode character, representable as a surrogate
+ // pair, not representable as 4 hex digits.
+ "\"foo\\u{10e6d}\"",
+ NULL};
+ RunParserSyncTest(context_data, data, kSuccess);
+}
« no previous file with comments | « src/scanner.cc ('k') | test/mjsunit/es6/unicode-escapes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698