Debian Codegraph @

js/src/tests/test262/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 throw new Test262Error("Expected an exception.");
28 } catch (e) {
29 verifyWritable(arrObj, "property", "setVerifyHelpProp");
30
31 if (!(e instanceof TypeError)) {
32 throw new Test262Error("Expected TypeError, got " + e);
33 }
34 }
35
36 verifyProperty(arrObj, "property", {
37 enumerable: false,
38 configurable: false,
39 });
40
41 reportCompare(0, 0);