-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests to verify valid object shorthand properties
Fixes #1202
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
test/language/expressions/object/identifier-shorthand-invalid-computed-name.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (C) 2017 The V8 Project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
description: > | ||
Object literal shorthands are only valid with identifier references, | ||
not computed property names. | ||
esid: sec-object-initializer | ||
info: | | ||
PropertyDefinition: | ||
IdentifierReference | ||
CoverInitializedName | ||
PropertyName : AssignmentExpression | ||
MethodDefinition | ||
PropertyName: | ||
LiteralPropertyName | ||
ComputedPropertyName | ||
negative: | ||
phase: early | ||
type: SyntaxError | ||
---*/ | ||
|
||
var x = "y"; | ||
var y = 42; | ||
|
||
throw "Test262: This statement should not be evaluated."; | ||
|
||
({[x]}); |
22 changes: 22 additions & 0 deletions
22
test/language/expressions/object/identifier-shorthand-invalid-zero.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (C) 2017 The V8 Project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
description: > | ||
Object literal shorthands are only valid with identifier references, | ||
not property names. (0) | ||
esid: sec-object-initializer | ||
info: | | ||
PropertyDefinition: | ||
IdentifierReference | ||
CoverInitializedName | ||
PropertyName : AssignmentExpression | ||
MethodDefinition | ||
negative: | ||
phase: early | ||
type: SyntaxError | ||
---*/ | ||
|
||
throw "Test262: This statement should not be evaluated."; | ||
|
||
({0}); |