Debian Codegraph @

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