Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-1.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-93-1
6 description: >
7 Object.defineProperties will update [[Value]] attribute of named
8 data property 'P' successfully when [[Configurable]] attribute is
9 true and [[Writable]] attribute is false but not when both are
10 false (8.12.9 - step Note & 10.a.ii.1)
11 includes: [propertyHelper.js]
12 ---*/
13
14
15 var obj = {};
16
17 Object.defineProperty(obj, "property", {
18 value: 1001,
19 writable: false,
20 configurable: true
21 });
22
23 Object.defineProperty(obj, "property1", {
24 value: 1003,
25 writable: false,
26 configurable: false
27 });
28
29 try {
30 Object.defineProperties(obj, {
31 property: {
32 value: 1002
33 },
34 property1: {
35 value: 1004
36 }
37 });
38
39 throw new Test262Error("Expected an exception.");
40 } catch (e) {
41 if (!(e instanceof TypeError)) {
42 throw new Test262Error("Expected TypeError, got " + e);
43 }
44 }
45
46 verifyProperty(obj, "property", {
47 value: 1002,
48 writable: false,
49 enumerable: false,
50 configurable: true,
51 });
52
53 verifyProperty(obj, "property1", {
54 value: 1003,
55 writable: false,
56 enumerable: false,
57 configurable: false,
58 });
59
60 reportCompare(0, 0);