| 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);
|
| +}
|
|
|