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

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

Issue 1019283002: [strong] Check constructor returns (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index dd328359a1c28b94724904f7aa061ce6392ffb35..2e5019fd13b6e8469ace2e37c5182c6f6bf42aaa 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -5608,6 +5608,32 @@ TEST(StrongSuperCalls) {
}
+TEST(StrongConstructorReturns) {
+ const char* sloppy_context_data[][2] = {{"", ""}, {NULL}};
+ const char* strict_context_data[][2] = {{"'use strict';", ""}, {NULL}};
+ const char* strong_context_data[][2] = {{"'use strong';", ""}, {NULL}};
+
+ const char* data[] = {
+ "class C extends Object { constructor() { super(); return {}; } }",
+ "class C extends Object { constructor() { super(); { return {}; } } }",
+ "class C extends Object { constructor() { super(); if (1) return {}; } }",
+ "class C extends Object { constructor() { return; super(); } }",
+ "class C extends Object { constructor() { { return; } super(); } }",
+ "class C extends Object { constructor() { if (0) return; super(); } }",
+ NULL};
+
+ static const ParserFlag always_flags[] = {
+ kAllowStrongMode, kAllowHarmonyClasses, kAllowHarmonyObjectLiterals
+ };
+ RunParserSyncTest(sloppy_context_data, data, kError, NULL, 0, always_flags,
+ arraysize(always_flags));
+ RunParserSyncTest(strict_context_data, data, kSuccess, NULL, 0, always_flags,
+ arraysize(always_flags));
+ RunParserSyncTest(strong_context_data, data, kError, NULL, 0, always_flags,
Dmitry Lomov (no reviews) 2015/03/19 13:59:41 Please add positive tests for strong mode: 'const
rossberg 2015/03/19 16:02:57 We don't have any 'positive' strong mode tests at
+ arraysize(always_flags));
+}
+
+
TEST(ArrowFunctionASIErrors) {
const char* context_data[][2] = {{"'use strict';", ""}, {"", ""},
{NULL, NULL}};
« src/messages.js ('K') | « src/preparser.cc ('k') | test/mjsunit/strong/classes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698