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

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

Issue 857433004: Report SyntaxError on Token::ILLEGAL in ParseTemplateLiteral (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
« src/preparser.h ('K') | « src/preparser.h ('k') | no next file » | 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 f08f9b31d901eb4c1b0483d4f2426d8437a8104f..24da4c7a06bc06164895dda8ab62462d111e117d 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -4552,6 +4552,28 @@ TEST(ScanUnterminatedTemplateLiterals) {
}
+TEST(TemplateLiteralsIllegalTokens) {
+ const char* context_data[][2] = {{"'use strict';", ""},
+ {"function foo(){ 'use strict';"
+ " var a, b, c; return ", "}"},
+ {NULL, NULL}};
+ const char* data[] = {
+ "`hello\\x`",
+ "`hello\\x${1}`",
+ "`hello${1}\\x`",
+ "`hello${1}\\x${2}`",
+ "`hello\\x\n`",
+ "`hello\\x\n${1}`",
+ "`hello${1}\\x\n`",
+ "`hello${1}\\x\n${2}`",
+ NULL};
+
+ static const ParserFlag always_flags[] = {kAllowHarmonyTemplates};
+ RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
+ arraysize(always_flags));
+}
+
+
TEST(LexicalScopingSloppyMode) {
const char* context_data[][2] = {
{"", ""},
« src/preparser.h ('K') | « src/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698