tests/auto/qml/ecmascripttests/test262/test/language/computed-property-names/object/method/generator.js
raw| 1 | // Copyright (C) 2014 the V8 project authors. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | /*--- |
| 4 | es6id: 12.2.5 |
| 5 | description: > |
| 6 | computed property names can be used as the name of a generator method in an object |
| 7 | includes: [compareArray.js] |
| 8 | ---*/ |
| 9 | var object = { |
| 10 | *['a']() { |
| 11 | yield 1; |
| 12 | yield 2; |
| 13 | } |
| 14 | }; |
| 15 | assert( |
| 16 | compareArray(Object.keys(object), ['a']), |
| 17 | "`compareArray(Object.keys(object), ['a'])` returns `true`" |
| 18 | ); |