Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-584.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.6-4-584
6 description: ES5 Attributes - Failed to add property into object (Date instance)
7 ---*/
8
9 var data = "data";
10
11 Object.defineProperty(Date.prototype, "prop", {
12 get: function() {
13 return data;
14 },
15 set: function(value) {
16 data = value;
17 },
18 enumerable: true,
19 configurable: true
20 });
21 var dateObj = new Date();
22 dateObj.prop = "myOwnProperty";
23
24 assert.sameValue(dateObj.hasOwnProperty("prop"), false, 'dateObj.hasOwnProperty("prop")');
25 assert.sameValue(dateObj.prop, "myOwnProperty", 'dateObj.prop');
26 assert.sameValue(data, "myOwnProperty", 'data');