Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/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 $ERROR("Expected an exception.");
30 } catch (e) {
31 verifyEqualTo(obj, "foo", 10);
32
33 verifyNotWritable(obj, "foo");
34
35 verifyNotEnumerable(obj, "foo");
36
37 verifyNotConfigurable(obj, "foo");
38
39 if (!(e instanceof TypeError)) {
40 $ERROR("Expected TypeError, got " + e);
41 }
42
43 }