Debian Codegraph @

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