Index: test/cctest/test-parsing.cc |
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc |
index 0106e5944f2a4db8ce44b7cc6a27f8997ceb8a9a..9768e30a55a6eac19f666e03f98a8a4c65f77d8d 100644 |
--- a/test/cctest/test-parsing.cc |
+++ b/test/cctest/test-parsing.cc |
@@ -1798,3 +1798,36 @@ TEST(NoErrorsIllegalWordsAsLabels) { |
RunParserSyncTest(context_data, statement_data, kSuccess); |
} |
+ |
+ |
+TEST(ErrorsParenthesizedLabels) { |
+ // Parenthesized identifiers shouldn't be recognized as labels. |
+ const char* context_data[][2] = { |
+ { "", ""}, |
+ { "function test_func() {", "}" }, |
+ { NULL, NULL } |
+ }; |
+ |
+ const char* statement_data[] = { |
+ "(mylabel): while(true) { break mylabel; }", |
+ NULL |
+ }; |
+ |
+ RunParserSyncTest(context_data, statement_data, kError); |
+} |
+ |
+ |
+TEST(NoErrorsParenthesizedDirectivePrologue) { |
+ // Parenthesized directive prologue shouldn't be recognized. |
+ const char* context_data[][2] = { |
+ { "", ""}, |
+ { NULL, NULL } |
+ }; |
+ |
+ const char* statement_data[] = { |
+ "(\"use strict\"); var eval;", |
+ NULL |
+ }; |
+ |
+ RunParserSyncTest(context_data, statement_data, kSuccess); |
+} |