Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-58.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-58
6 description: >
7 Object.defineProperties - desc.[[Get]] and P.[[Get]] are two
8 objects which refer to the different objects (8.12.9 step 6)
9 includes: [propertyHelper.js]
10 ---*/
11
12 var obj = {};
13
14 function get_Func1() {
15 return 10;
16 }
17
18 Object.defineProperty(obj, "foo", {
19 get: get_Func1,
20 configurable: true
21 });
22
23 function get_Func2() {
24 return 20;
25 }
26
27 Object.defineProperties(obj, {
28 foo: {
29 get: get_Func2
30 }
31 });
32
33 assert.sameValue(obj.foo, 20);
34
35 var desc = Object.getOwnPropertyDescriptor(obj, "foo");
36
37 verifyProperty(obj, "foo", {
38 enumerable: false,
39 configurable: true,
40 });
41
42 assert.sameValue(typeof(desc.set), "undefined", 'typeof (desc.set)');
43 assert.sameValue(desc.get, get_Func2, 'desc.get');
44
45 reportCompare(0, 0);