Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-531-1.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-531-1
6 description: >
7 Object.defineProperty will update [[Get]] and [[Set]] attributes
8 of named accessor property 'P' successfully when [[Configurable]]
9 attribute is true, 'O' is an Object object (8.12.9 step 11)
10 includes: [propertyHelper.js]
11 ---*/
12
13
14 var obj = {};
15 obj.verifySetFunction = "data";
16 Object.defineProperty(obj, "property", {
17 get: function() {
18 return obj.verifySetFunction;
19 },
20 set: function(value) {
21 obj.verifySetFunction = value;
22 },
23 configurable: true
24 });
25
26 obj.verifySetFunction1 = "data1";
27 var getFunc = function() {
28 return obj.verifySetFunction1;
29 };
30 var setFunc = function(value) {
31 obj.verifySetFunction1 = value;
32 };
33
34 Object.defineProperty(obj, "property", {
35 get: getFunc,
36 set: setFunc
37 });
38
39 verifyEqualTo(obj, "property", getFunc());
40
41 verifyWritable(obj, "property", "verifySetFunction1");
42
43 verifyNotEnumerable(obj, "property");
44
45 verifyConfigurable(obj, "property");