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

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
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 79d76546e90b117404d191bcf59bfa2f33ec5c20..eb9626def989aa5f0f0a709b9fec4f5ea8820f9d 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -4305,6 +4305,43 @@ TEST(InvalidUnicodeEscapes) {
// No escapes allowed in regexp flags
"/regex/\\u0069g",
"/regex/\\u006g",
+ // Braces gone wrong
+ "var foob\\u{c481r = 0;",
+ "var foob\\uc481}r = 0;",
+ "var foob\\u{c4}r = 0;",
+ "var \\u{0052oo = 0;",
+ "var \\u0052}oo = 0;",
+ "var \\u{00}oo = 0;",
+ "\"foob\\u{c481r\"",
+ "\"foob\\u{c4}r\"",
arv (Not doing code reviews) 2014/11/07 16:23:20 Can you add a test for http://people.mozilla.org
marja 2014/11/13 11:53:20 Done.
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;",
+ // 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/",
arv (Not doing code reviews) 2014/11/07 16:23:20 Can you add a test with more than 4 hex numbers?
marja 2014/11/13 11:53:20 Done.
+ NULL};
+ RunParserSyncTest(context_data, data, kSuccess);
+}

Powered by Google App Engine
This is Rietveld 408576698