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

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

Issue 329413002: Throw syntax error when a getter/setter has the wrong number of params (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test exception 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/preparser.cc ('k') | test/mozilla/mozilla.status » ('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 533c6249ca9abee8dd498ffaf216a2c823554744..c571c1cc955ac8f95e3595fafae50c439f438f73 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -2230,22 +2230,27 @@ TEST(ErrorsObjectLiteralChecking) {
const char* statement_data[] = {
"foo: 1, get foo() {}",
- "foo: 1, set foo() {}",
+ "foo: 1, set foo(v) {}",
"\"foo\": 1, get \"foo\"() {}",
- "\"foo\": 1, set \"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\"() {}",
+ "foo: 1, set \"foo\"(v) {}",
"\"foo\": 1, get foo() {}",
- "\"foo\": 1, set foo() {}",
+ "\"foo\": 1, set foo(v) {}",
"1: 1, get \"1\"() {}",
"1: 1, set \"1\"() {}",
"\"1\": 1, get 1() {}"
- "\"1\": 1, set 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\"",
@@ -2269,25 +2274,22 @@ TEST(NoErrorsObjectLiteralChecking) {
"1: 1, 2: 2",
// Syntax: IdentifierName ':' AssignmentExpression
"foo: bar = 5 + baz",
- // Syntax: 'get' (IdentifierName | String | Number) FunctionLiteral
+ // Syntax: 'get' PropertyName '(' ')' '{' FunctionBody '}'
"get foo() {}",
"get \"foo\"() {}",
"get 1() {}",
- // Syntax: 'set' (IdentifierName | String | Number) FunctionLiteral
- "set foo() {}",
- "set \"foo\"() {}",
- "set 1() {}",
+ // Syntax: 'set' PropertyName '(' PropertySetParameterList ')'
+ // '{' FunctionBody '}'
+ "set foo(v) {}",
+ "set \"foo\"(v) {}",
+ "set 1(v) {}",
// Non-colliding getters and setters -> no errors
"foo: 1, get bar() {}",
- "foo: 1, set bar(b) {}",
+ "foo: 1, set bar(v) {}",
"\"foo\": 1, get \"bar\"() {}",
- "\"foo\": 1, set \"bar\"() {}",
+ "\"foo\": 1, set \"bar\"(v) {}",
"1: 1, get 2() {}",
- "1: 1, set 2() {}",
- // Weird number of parameters -> no errors
- "get bar() {}, set bar() {}",
- "get bar(x) {}, set bar(x) {}",
- "get bar(x, y) {}, set bar(x, y) {}",
+ "1: 1, set 2(v) {}",
// Keywords, future reserved and strict future reserved are also allowed as
// property names.
"if: 4",
« no previous file with comments | « src/preparser.cc ('k') | test/mozilla/mozilla.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698