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

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

Issue 1306583002: Fix parsing of arrow function formal parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Add ConditionalExpression tests. Created 5 years, 4 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 ac52dfd7ab21f3fb6cd8a9a1afe4e523b2a9abaf..23a3d2621a8fa78b1ce38d8a8dbbd04f58f6251d 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -3510,6 +3510,67 @@ TEST(UseConstLegacyCount) {
}
+TEST(ErrorsArrowFormalParameters) {
+ const char* context_data[][2] = {
+ { "()", "=>{}" },
+ { "()", "=>{};" },
+ { "var x = ()", "=>{}" },
+ { "var x = ()", "=>{};" },
+
+ { "a", "=>{}" },
+ { "a", "=>{};" },
+ { "var x = a", "=>{}" },
+ { "var x = a", "=>{};" },
+
+ { "(a)", "=>{}" },
+ { "(a)", "=>{};" },
+ { "var x = (a)", "=>{}" },
+ { "var x = (a)", "=>{};" },
+
+ { "(...a)", "=>{}" },
+ { "(...a)", "=>{};" },
+ { "var x = (...a)", "=>{}" },
+ { "var x = (...a)", "=>{};" },
+
+ { "(a,b)", "=>{}" },
+ { "(a,b)", "=>{};" },
+ { "var x = (a,b)", "=>{}" },
+ { "var x = (a,b)", "=>{};" },
+
+ { "(a,...b)", "=>{}" },
+ { "(a,...b)", "=>{};" },
+ { "var x = (a,...b)", "=>{}" },
+ { "var x = (a,...b)", "=>{};" },
+
+ { nullptr, nullptr }
+ };
+ const char* assignment_expression_suffix_data[] = {
+ "?c:d=>{}",
+ "=c=>{}",
+ "()",
+ "(c)",
+ "[1]",
+ "[c]",
+ ".c",
+ "-c",
+ "+c",
+ "c++",
+ "`c`",
+ "`${c}`",
+ "`template-head${c}`",
+ "`${c}template-tail`",
+ "`template-head${c}template-tail`",
+ "`${c}template-tail`",
+ nullptr
+ };
+
+ static const ParserFlag always_flags[] = { kAllowHarmonyArrowFunctions,
+ kAllowHarmonyRestParameters };
+ RunParserSyncTest(context_data, assignment_expression_suffix_data, kError,
+ NULL, 0, always_flags, arraysize(always_flags));
+}
+
+
TEST(ErrorsArrowFunctions) {
// Tests that parser and preparser generate the same kind of errors
// on invalid arrow function syntax.
« 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