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}}; |