Debian Codegraph @

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