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

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

Issue 352173004: Relax object literal checking to follow ES6 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/mjsunit/strict-mode.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 857089ea0662ca374051c07ae000c8da59a04a77..0fea949cda154266a45cdb9837bb1e93cb8b228e 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -2262,11 +2262,11 @@ TEST(StrictObjectLiteralChecking) {
};
RunParserSyncTest(non_strict_context_data, statement_data, kSuccess);
- RunParserSyncTest(strict_context_data, statement_data, kError);
+ RunParserSyncTest(strict_context_data, statement_data, kSuccess);
}
-TEST(ErrorsObjectLiteralChecking) {
+TEST(DuplicatePropertyObjectLiteralChecking) {
const char* context_data[][2] = {
{"\"use strict\"; var myobject = {", "};"},
{"var myobject = {", "};"},
@@ -2274,29 +2274,44 @@ TEST(ErrorsObjectLiteralChecking) {
};
const char* statement_data[] = {
- ",",
"foo: 1, get foo() {}",
"foo: 1, set foo(v) {}",
"\"foo\": 1, get \"foo\"() {}",
"\"foo\": 1, set \"foo\"(v) {}",
"1: 1, get 1() {}",
- "1: 1, set 1() {}",
- // It's counter-intuitive, but these collide too (even in classic
- // mode). Note that we can have "foo" and foo as properties in classic mode,
- // but we cannot have "foo" and get foo, or foo and get "foo".
+ "1: 1, set 1(v) {}",
"foo: 1, get \"foo\"() {}",
"foo: 1, set \"foo\"(v) {}",
"\"foo\": 1, get foo() {}",
"\"foo\": 1, set foo(v) {}",
"1: 1, get \"1\"() {}",
- "1: 1, set \"1\"() {}",
- "\"1\": 1, get 1() {}"
- "\"1\": 1, set 1(v) {}"
+ "1: 1, set \"1\"(v) {}",
+ "\"1\": 1, get 1() {}",
+ "\"1\": 1, set 1(v) {}",
+ NULL
+ };
+
+ RunParserSyncTest(context_data, statement_data, kSuccess);
+}
+
+
+TEST(ErrorsObjectLiteralChecking) {
+ const char* context_data[][2] = {
+ {"\"use strict\"; var myobject = {", "};"},
+ {"var myobject = {", "};"},
+ { NULL, NULL }
+ };
+
+ const char* statement_data[] = {
+ // {,} is invalid
+ ",",
// Wrong number of parameters
"get bar(x) {}",
"get bar(x, y) {}",
"set bar() {}",
"set bar(x, y) {}",
+ "set 1() {}",
+ "set \"1\"() {}",
// Parsing FunctionLiteral for getter or setter fails
"get foo( +",
"get foo() \"error\"",
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/mjsunit/strict-mode.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698