Index: test/cctest/test-parsing.cc |
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc |
index 7f2a072e21fe6523dda8dc95048f11106807e22e..fa98a2b455ab9fafe0ec4442b932c4da3b6352ea 100644 |
--- a/test/cctest/test-parsing.cc |
+++ b/test/cctest/test-parsing.cc |
@@ -5901,6 +5901,33 @@ TEST(UnicodeEscapes) { |
RunParserSyncTest(context_data, data, kSuccess); |
} |
+TEST(OctalEscapes) { |
+ const char* sloppy_context_data[][2] = {{"", ""}, // as a directive |
+ {"0;", ""}, // as a string literal |
+ {NULL, NULL}}; |
+ |
+ const char* strict_context_data[][2] = { |
+ {"'use strict';", ""}, // as a directive before 'use strict' |
+ {"", ";'use strict';"}, // as a directive after 'use strict' |
+ {"'use strict'; 0;", ""}, // as a string literal |
+ {NULL, NULL}}; |
+ |
+ // clang-format off |
+ const char* data[] = { |
+ "'\\1'", |
+ "'\\01'", |
+ "'\\001'", |
+ "'\\08'", |
+ "'\\09'", |
+ NULL}; |
+ // clang-format on |
+ |
+ // Permitted in sloppy mode |
+ RunParserSyncTest(sloppy_context_data, data, kSuccess); |
+ |
+ // Error in strict mode |
+ RunParserSyncTest(strict_context_data, data, kError); |
+} |
TEST(ScanTemplateLiterals) { |
const char* context_data[][2] = {{"'use strict';", ""}, |
@@ -7112,6 +7139,7 @@ TEST(TemplateEscapesPositiveTests) { |
// clang-format off |
const char* data[] = { |
+ "tag`\\08`", |
"tag`\\01`", |
"tag`\\01${0}right`", |
"tag`left${0}\\01`", |
@@ -7195,6 +7223,7 @@ TEST(TemplateEscapesNegativeTests) { |
// clang-format off |
const char* data[] = { |
+ "`\\08`", |
"`\\01`", |
"`\\01${0}right`", |
"`left${0}\\01`", |