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

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

Issue 1308213003: Version 4.5.103.28 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.5
Patch Set: 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
« no previous file with comments | « 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 cbb79b16da9cc757f385978cb90193f14614163d..cfb43911aa2b3dc56e551782a400ffc8d0ece5fc 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -3516,6 +3516,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.
« no previous file with comments | « src/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698