Debian Codegraph @

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