Debian Codegraph @

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