Index: test/cctest/test-parsing.cc |
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc |
index a086c3ec617142db00252cb462ba2a06506ac4e3..c735c03470cbe7b5cafceefde6998424c35e5613 100644 |
--- a/test/cctest/test-parsing.cc |
+++ b/test/cctest/test-parsing.cc |
@@ -4628,6 +4628,67 @@ TEST(ConstParsingInForInError) { |
} |
+TEST(InitializedDeclarationsInStrictForInError) { |
+ const char* context_data[][2] = {{"'use strict';", ""}, |
+ {"function foo(){ 'use strict';", "}"}, |
+ {NULL, NULL}}; |
+ |
+ const char* data[] = { |
+ "for (var i = 1 in {}) {}", |
+ "for (var i = void 0 in [1, 2, 3]) {}", |
+ "for (let i = 1 in {}) {}", |
+ "for (let i = void 0 in [1, 2, 3]) {}", |
+ "for (const i = 1 in {}) {}", |
+ "for (const i = void 0 in [1, 2, 3]) {}", |
+ NULL}; |
+ RunParserSyncTest(context_data, data, kError, nullptr, 0, nullptr, 0); |
marja
2015/04/08 10:05:47
You don't need the params after kError.
|
+} |
+ |
+ |
+TEST(InitializedDeclarationsInStrictForOfError) { |
+ const char* context_data[][2] = {{"'use strict';", ""}, |
+ {"function foo(){ 'use strict';", "}"}, |
+ {NULL, NULL}}; |
+ |
+ const char* data[] = { |
+ "for (var i = 1 of {}) {}", |
+ "for (var i = void 0 of [1, 2, 3]) {}", |
+ "for (let i = 1 of {}) {}", |
+ "for (let i = void 0 of [1, 2, 3]) {}", |
+ "for (const i = 1 of {}) {}", |
+ "for (const i = void 0 of [1, 2, 3]) {}", |
+ NULL}; |
+ RunParserSyncTest(context_data, data, kError, nullptr, 0, nullptr, 0); |
+} |
+ |
+ |
+TEST(InitializedDeclarationsInSloppyForInError) { |
+ const char* context_data[][2] = {{"", ""}, |
+ {"function foo(){", "}"}, |
+ {NULL, NULL}}; |
+ |
+ const char* data[] = { |
+ "for (var i = 1 in {}) {}", |
+ "for (var i = void 0 in [1, 2, 3]) {}", |
+ NULL}; |
+ // TODO(caitp): This should be an error in sloppy mode. |
+ RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, nullptr, 0); |
+} |
+ |
+ |
+TEST(InitializedDeclarationsInSloppyForOfError) { |
+ const char* context_data[][2] = {{"", ""}, |
+ {"function foo(){", "}"}, |
+ {NULL, NULL}}; |
+ |
+ const char* data[] = { |
+ "for (var i = 1 of {}) {}", |
+ "for (var i = void 0 of [1, 2, 3]) {}", |
+ NULL}; |
+ RunParserSyncTest(context_data, data, kError, nullptr, 0, nullptr, 0); |
+} |
+ |
+ |
marja
2015/04/08 10:05:47
Hmm, none of the added tests exercises the code pa
caitp (gmail)
2015/04/08 12:44:36
done
|
TEST(InvalidUnicodeEscapes) { |
const char* context_data[][2] = {{"", ""}, |
{"'use strict';", ""}, |