Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperties/15.2.3.7-6-a-237.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-237
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 numbers with different vaule
12 (15.4.5.1 step 4.c)
13 includes: [propertyHelper.js]
14 ---*/
15
16
17 var arr = [];
18
19 Object.defineProperty(arr, "1", {
20 value: 12
21 });
22
23 try {
24 Object.defineProperties(arr, {
25 "1": {
26 value: 36
27 }
28 });
29 $ERROR("Expected an exception.");
30 } catch (e) {
31 verifyEqualTo(arr, "1", 12);
32
33 verifyNotWritable(arr, "1");
34
35 verifyNotEnumerable(arr, "1");
36
37 verifyNotConfigurable(arr, "1");
38
39 if (!(e instanceof TypeError)) {
40 $ERROR("Expected TypeError, got " + e);
41 }
42
43 }