Debian Codegraph @

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