Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-221.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-221
6 description: >
7 Object.defineProperty - 'O' is an Array, 'name' is an array index
8 property, test TypeError is thrown when the [[Value]] field of
9 'desc' and the [[Value]] attribute value of 'name' are two numbers
10 with different values (15.4.5.1 step 4.c)
11 includes: [propertyHelper.js]
12 ---*/
13
14 var arrObj = [];
15
16 Object.defineProperty(arrObj, 0, {
17 value: 101,
18 writable: false,
19 configurable: false
20 });
21
22 try {
23 Object.defineProperty(arrObj, "0", {
24 value: 123
25 });
26 $ERROR("Expected an exception.");
27 } catch (e) {
28 verifyEqualTo(arrObj, "0", 101);
29
30 verifyNotWritable(arrObj, "0");
31
32 verifyNotEnumerable(arrObj, "0");
33
34 verifyNotConfigurable(arrObj, "0");
35
36 if (!(e instanceof TypeError)) {
37 $ERROR("Expected TypeError, got " + e);
38 }
39
40 }