Debian Codegraph @

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