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

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

Issue 1314203002: [strong] Class constructor bodies cannot contain "use strong" directive (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: formatting 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
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 1ea550caab1dc65b1fe0f320531bb250748c604d..3c1207e46502d88ec1ab7427751ee5685807510c 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -6098,6 +6098,33 @@ TEST(StrongConstructorReturns) {
}
+TEST(StrongConstructorDirective) {
+ const char* context_data[][2] = {{"class c { ", " }"},
+ {"(class c { ", " });"},
+ {"let a = (class c { ", " });"},
+ {NULL}};
+
+ const char* error_data[] = {
+ "constructor() { \"use strong\" }",
+ "constructor(...rest) { \"use strong\" }",
+ "foo() {} constructor() { \"use strong\" }",
+ "foo(...rest) { \"use strict\" } constructor() { \"use strong\" }", NULL};
+
+ const char* success_data[] = {
+ "constructor() { \"use strict\" }", "foo() { \"use strong\" }",
+ "foo() { \"use strong\" } constructor() {}", NULL};
+
+ static const ParserFlag always_flags[] = {
+ kAllowHarmonyRestParameters, kAllowHarmonySloppy, kAllowHarmonySloppyLet,
+ kAllowStrongMode};
+
+ RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags,
+ arraysize(always_flags));
+ RunParserSyncTest(context_data, success_data, kSuccess, NULL, 0, always_flags,
+ arraysize(always_flags));
+}
+
+
TEST(StrongUndefinedLocal) {
const char* context_data[][2] = {{"", ""}, {NULL}};

Powered by Google App Engine
This is Rietveld 408576698