Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-287.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-287
6 description: >
7 Object.defineProperty - 'O' is an Array, 'name' is generic own
8 accessor property of 'O', test TypeError is thrown when updating
9 the [[Enumerable]] attribute value of 'name' which is defined as
10 non-configurable (15.4.5.1 step 5)
11 includes: [propertyHelper.js]
12 ---*/
13
14
15 var arrObj = [];
16
17 function setFunc(value) {
18 arrObj.setVerifyHelpProp = value;
19 }
20 Object.defineProperty(arrObj, "property", {
21 set: setFunc,
22 enumerable: false
23 });
24 try {
25 Object.defineProperty(arrObj, "property", {
26 enumerable: true
27 });
28 $ERROR("Expected an exception.");
29 } catch (e) {
30 verifyWritable(arrObj, "property", "setVerifyHelpProp");
31
32 verifyNotEnumerable(arrObj, "property");
33
34 verifyNotConfigurable(arrObj, "property");
35
36 if (!(e instanceof TypeError)) {
37 $ERROR("Expected TypeError, got " + e);
38 }
39
40 }