Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-286.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-286
6 description: >
7 Object.defineProperty - 'O' is an Array, 'name' is generic own
8 accessor property of 'O', and 'desc' is accessor descriptor, test
9 TypeError is thrown when updating the [[Set]] attribute value of
10 'name' (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 });
23 try {
24 Object.defineProperty(arrObj, "property", {
25 set: function() {}
26 });
27 $ERROR("Expected an exception.");
28 } catch (e) {
29 verifyWritable(arrObj, "property", "setVerifyHelpProp");
30
31 verifyNotEnumerable(arrObj, "property");
32
33 verifyNotConfigurable(arrObj, "property");
34
35 if (!(e instanceof TypeError)) {
36 $ERROR("Expected TypeError, got " + e);
37 }
38
39 }