Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperties/15.2.3.7-6-a-67.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-67
6 description: >
7 Object.defineProperties throws TypeError when P is accessor
8 property and P.configurable is false, desc is data property
9 (8.12.9 step 9.a)
10 includes: [propertyHelper.js]
11 ---*/
12
13 var obj = {};
14
15 function get_Func() {
16 return 10;
17 }
18
19 Object.defineProperty(obj, "foo", {
20 get: get_Func,
21 configurable: false
22 });
23
24 try {
25 Object.defineProperties(obj, {
26 foo: {
27 value: 11
28 }
29 });
30
31 $ERROR("Expected TypeError");
32 } catch (e) {
33 assert(e instanceof TypeError);
34 verifyNotEnumerable(obj, "foo");
35
36 assert.sameValue(obj.foo, 10);
37
38 verifyNotConfigurable(obj, "foo");
39
40 var desc = Object.getOwnPropertyDescriptor(obj, "foo");
41
42 assert.sameValue(typeof(desc.set), "undefined");
43 assert.sameValue(desc.get, get_Func);
44 }