Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-243-2.js

raw
1 // Copyright (c) 2012 Ecma International. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 es5id: 15.2.3.6-4-243-2
6 description: >
7 Object.defineProperty - 'O' is an Array, 'name' is an array index
8 named property, 'name' is accessor property and assignment to
9 the accessor property, fails to convert accessor property from
10 accessor property to data property (15.4.5.1 step 4.c)
11 includes: [propertyHelper.js]
12 flags: [onlyStrict]
13 ---*/
14
15
16 var arrObj = [];
17
18 function getFunc() {
19 return 3;
20 }
21 Object.defineProperty(arrObj, "1", {
22 get: getFunc,
23 configurable: true
24 });
25
26 try {
27 arrObj[1] = 4;
28 } catch (e) {
29 verifyEqualTo(arrObj, "1", getFunc());
30
31 verifyNotEnumerable(arrObj, "1");
32
33 verifyConfigurable(arrObj, "1");
34
35 if (!(e instanceof TypeError)) {
36 $ERROR("Expected TypeError, got " + e);
37 }
38
39 }