Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/create/15.2.3.5-4-25.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.5-4-25
6 description: >
7 Object.create - own enumerable accessor property that overrides an
8 enumerable inherited accessor property in 'Properties' is defined
9 in 'obj' (15.2.3.7 step 5.a)
10 ---*/
11
12 var proto = {};
13 Object.defineProperty(proto, "prop", {
14 get: function() {
15 return {
16 value: 9
17 };
18 },
19 enumerable: true
20 });
21
22 var ConstructFun = function() {};
23 ConstructFun.prototype = proto;
24
25 var child = new ConstructFun();
26 Object.defineProperty(child, "prop", {
27 get: function() {
28 return {
29 value: 12
30 };
31 },
32 enumerable: true
33 });
34 var newObj = Object.create({}, child);
35
36 assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true');
37 assert.sameValue(newObj.prop, 12, 'newObj.prop');