Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-194.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-194
6 description: >
7 Object.defineProperty - 'O' is an Array, 'name' is an array index
8 named property, 'name' is own accessor property, test TypeError is
9 thrown on updating the configurable attribute from false to true
10 (15.4.5.1 step 4.c)
11 includes: [propertyHelper.js]
12 ---*/
13
14 var arrObj = [];
15 var getFunc = function() {
16 return 11;
17 };
18
19 Object.defineProperty(arrObj, "0", {
20 get: getFunc,
21 configurable: false
22 });
23
24 try {
25 Object.defineProperty(arrObj, "0", {
26 configurable: true
27 });
28 $ERROR("Expected an exception.");
29 } catch (e) {
30 verifyEqualTo(arrObj, "0", getFunc());
31
32 verifyNotEnumerable(arrObj, "0");
33
34 verifyNotConfigurable(arrObj, "0");
35
36 if (!(e instanceof TypeError)) {
37 $ERROR("Expected TypeError, got " + e.name);
38 }
39
40 }