Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperty/15.2.3.6-4-241.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-241
6 description: >
7 Object.defineProperty - 'O' is an Array, 'name' is an array index
8 named property, TypeError is thrown if 'name' is data property,
9 and'desc' is accessor descriptor, and the [[Configurable]]
10 attribute value of 'name' is false (15.4.5.1 step 4.c)
11 includes: [propertyHelper.js]
12 ---*/
13
14
15 var arrObj = [];
16
17 Object.defineProperty(arrObj, "1", {
18 value: 3,
19 configurable: false
20 });
21
22 try {
23 Object.defineProperty(arrObj, "1", {
24 set: function() {}
25 });
26 throw new Test262Error("Expected an exception.");
27 } catch (e) {
28 if (!(e instanceof TypeError)) {
29 throw new Test262Error("Expected TypeError, got " + e);
30 }
31 }
32
33 verifyProperty(arrObj, "1", {
34 value: 3,
35 writable: false,
36 enumerable: false,
37 configurable: false,
38 });
39
40 reportCompare(0, 0);