Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperties/15.2.3.7-6-a-228.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-228
6 description: >
7 Object.defineProperties - 'O' is an Array, 'P' is an array index
8 property, TypeError is thrown if the [[Configurable]] attribute
9 value of 'P' is false, and [[Enumerable]] of 'desc' is present and
10 its value is different from the [[Enumerable]] attribute value of
11 'P' (15.4.5.1 step 4.c)
12 includes: [propertyHelper.js]
13 ---*/
14
15
16 var arr = [];
17
18 Object.defineProperty(arr, "1", {
19 value: 3,
20 configurable: false,
21 enumerable: false
22
23 });
24
25 try {
26 Object.defineProperties(arr, {
27 "1": {
28 value: 13,
29 enumerable: true
30 }
31 });
32 $ERROR("Expected an exception.");
33 } catch (e) {
34 verifyEqualTo(arr, "1", 3);
35
36 verifyNotWritable(arr, "1");
37
38 verifyNotEnumerable(arr, "1");
39
40 verifyNotConfigurable(arr, "1");
41
42 if (!(e instanceof TypeError)) {
43 $ERROR("Expected TypeError, got " + e);
44 }
45
46 }