Debian Codegraph @

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