Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-285.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-285
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 [[Get]] 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 getFunc() {
18 return 12;
19 }
20
21 function setFunc(value) {
22 arrObj.setVerifyHelpProp = value;
23 }
24 Object.defineProperty(arrObj, "property", {
25 get: getFunc,
26 set: setFunc
27 });
28 try {
29 Object.defineProperty(arrObj, "property", {
30 get: function() {
31 return 36;
32 }
33 });
34 $ERROR("Expected an exception.");
35 } catch (e) {
36 verifyEqualTo(arrObj, "property", getFunc());
37
38 verifyWritable(arrObj, "property", "setVerifyHelpProp");
39
40 verifyNotEnumerable(arrObj, "property");
41
42 verifyNotConfigurable(arrObj, "property");
43
44 if (!(e instanceof TypeError)) {
45 $ERROR("Expected TypeError, got " + e);
46 }
47
48 }