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

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

Issue 491053002: Add back the duplicate property checker (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« no previous file with comments | « src/preparser.h ('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 31651904e3a2ca7dc42862bba55188d9de89b1e6..57671c0d9e11907e8bbeaec4f8f5fdb3ab087fee 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -2486,7 +2486,7 @@ TEST(StrictObjectLiteralChecking) {
{ NULL, NULL }
};
- // ES6 allows duplicate properties even in strict mode.
+ // These are only errors in strict mode.
const char* statement_data[] = {
"foo: 1, foo: 2",
"\"foo\": 1, \"foo\": 2",
@@ -2499,7 +2499,7 @@ TEST(StrictObjectLiteralChecking) {
};
RunParserSyncTest(non_strict_context_data, statement_data, kSuccess);
- RunParserSyncTest(strict_context_data, statement_data, kSuccess);
+ RunParserSyncTest(strict_context_data, statement_data, kError);
}
@@ -2511,17 +2511,23 @@ TEST(ErrorsObjectLiteralChecking) {
};
const char* statement_data[] = {
- ",",
- // Wrong number of parameters
- "get bar(x) {}",
- "get bar(x, y) {}",
- "set bar() {}",
- "set bar(x, y) {}",
- // Parsing FunctionLiteral for getter or setter fails
- "get foo( +",
- "get foo() \"error\"",
- NULL
- };
+ ",", "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".
+ "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) {}"
+ // Wrong number of parameters
+ "get bar(x) {}",
+ "get bar(x, y) {}", "set bar() {}", "set bar(x, y) {}",
+ // Parsing FunctionLiteral for getter or setter fails
+ "get foo( +", "get foo() \"error\"", NULL};
RunParserSyncTest(context_data, statement_data, kError);
}
@@ -2565,24 +2571,6 @@ TEST(NoErrorsObjectLiteralChecking) {
"super: 6",
"eval: 7",
"arguments: 8",
- // Duplicate property names are allowed in ES6.
- "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(v) {}",
- // 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".
- "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\"(v) {}",
- "\"1\": 1, get 1() {}",
- "\"1\": 1, set 1(v) {}",
NULL
};
« no previous file with comments | « src/preparser.h ('k') | test/mjsunit/strict-mode.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698