Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-5.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-5
6 description: >
7 Object.defineProperties - 'P' is own accessor property (8.12.9
8 step 1 )
9 includes: [propertyHelper.js]
10 ---*/
11
12 var obj = {};
13
14 function getFunc() {
15 return 11;
16 }
17
18 Object.defineProperty(obj, "prop", {
19 get: getFunc,
20 configurable: false
21 });
22
23 try {
24 Object.defineProperties(obj, {
25 prop: {
26 value: 12,
27 configurable: true
28 }
29 });
30 throw new Test262Error("Expected an exception.");
31 } catch (e) {
32 if (!(e instanceof TypeError)) {
33 throw new Test262Error("Expected TypeError, got " + e);
34 }
35 }
36
37 verifyEqualTo(obj, "prop", getFunc());
38
39 verifyProperty(obj, "prop", {
40 enumerable: false,
41 configurable: false,
42 });
43
44 reportCompare(0, 0);