Debian Codegraph @

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