Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperties/15.2.3.7-5-b-230.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-5-b-230
6 description: >
7 Object.defineProperties - 'set' property of 'descObj' is own data
8 property that overrides an inherited data property (8.10.5 step
9 8.a)
10 ---*/
11
12 var data1 = "data";
13 var data2 = "data";
14 var proto = {
15 set: function(value) {
16 data2 = value;
17 }
18 };
19
20 var Con = function() {};
21 Con.prototype = proto;
22
23 var child = new Con();
24 child.set = function(value) {
25 data1 = value;
26 };
27
28 var obj = {};
29
30 Object.defineProperties(obj, {
31 prop: child
32 });
33
34 obj.prop = "overrideData";
35
36 assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true');
37 assert.sameValue(data1, "overrideData", 'data1');
38 assert.sameValue(data2, "data", 'data2');