Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-531-15.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-15
6 description: >
7 ES5 Attributes - Updating a named accessor property 'P' using
8 simple assignment is successful, 'A' is an Array object (8.12.5
9 step 5.b)
10 ---*/
11
12 var obj = [];
13
14 var verifySetFunc = "data";
15 var setFunc = function(value) {
16 verifySetFunc = value;
17 };
18 var getFunc = function() {
19 return verifySetFunc;
20 };
21
22 Object.defineProperty(obj, "prop", {
23 get: getFunc,
24 set: setFunc,
25 enumerable: true,
26 configurable: true
27 });
28
29 obj.prop = "overrideData";
30 var propertyDefineCorrect = obj.hasOwnProperty("prop");
31 var desc = Object.getOwnPropertyDescriptor(obj, "prop");
32
33 assert(propertyDefineCorrect, 'propertyDefineCorrect !== true');
34 assert.sameValue(desc.set, setFunc, 'desc.set');
35 assert.sameValue(obj.prop, "overrideData", 'obj.prop');