Debian Codegraph @

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