diff options
author | Leo Balter <leonardo.balter@gmail.com> | 2017-03-16 12:16:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 12:16:27 -0400 |
commit | e45b2ae532348e512d8d7c52a1082634f292f900 (patch) | |
tree | 00123002b1bcb6359c3170517fc4be9a50977359 /test/annexB | |
parent | 2f11b4d80629cbb602426118c6fed72905030221 (diff) | |
download | qtdeclarative-testsuites-e45b2ae532348e512d8d7c52a1082634f292f900.tar.gz |
Add tests for computed __proto__ property keys (#916)
Fixes #904
Diffstat (limited to 'test/annexB')
-rw-r--r-- | test/annexB/language/expressions/object/__proto__-duplicate-computed.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/annexB/language/expressions/object/__proto__-duplicate-computed.js b/test/annexB/language/expressions/object/__proto__-duplicate-computed.js new file mode 100644 index 000000000..838511019 --- /dev/null +++ b/test/annexB/language/expressions/object/__proto__-duplicate-computed.js @@ -0,0 +1,54 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-__proto__-property-names-in-object-initializers +es6id: B.3.1 +description: > + The syntax error for duplicate `__proto__` property is not valid if the duplicate is a + ComputedPropertyName +info: | + B.3.1__proto__ Property Names in Object Initializers + + It is a Syntax Error if PropertyNameList of PropertyDefinitionList contains any duplicate + entries for "__proto__" and at least two of those entries were obtained from productions of + the form + PropertyDefinition : PropertyName : AssignmentExpression . + + 12.2.6.6 Static Semantics: PropertyNameList + + ... + 3. Append PropName of PropertyDefinition to the end of list. + ... + + 12.2.6.5 Static Semantics: PropName + + ComputedPropertyName : [ AssignmentExpression ] + 1. Return empty. +---*/ + +var obj; +var proto = {}; +var ownProp = {}; + +obj = { + __proto__: proto, + ['__proto__']: {}, + ['__proto__']: ownProp +}; + +assert.sameValue( + Object.getPrototypeOf(obj), + proto, + 'prototype is defined' +); + +assert( + Object.hasOwnProperty.call(obj, '__proto__'), + 'has own property __proto__' +); + +assert.sameValue( + obj.__proto__, + ownProp, + 'own property value' +); |