15.2.3.6-4-538-1.js (1598B)
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-538-1 6 description: > 7 ES5 Attributes - Updating an indexed 'P' whose [[Configurable]] 8 attribute is true to a data property is successful, 'A' is an 9 Array object (8.12.9 - step 9.c.i) 10 includes: [propertyHelper.js] 11 ---*/ 12 13 var obj = []; 14 15 obj.verifySetFunc = "data"; 16 var getFunc = function() { 17 return obj.verifySetFunc; 18 }; 19 20 var setFunc = function(value) { 21 obj.verifySetFunc = value; 22 }; 23 24 Object.defineProperty(obj, "0", { 25 get: getFunc, 26 set: setFunc, 27 enumerable: true, 28 configurable: true 29 }); 30 var desc1 = Object.getOwnPropertyDescriptor(obj, "0"); 31 32 Object.defineProperty(obj, "0", { 33 value: 1001 34 }); 35 var desc2 = Object.getOwnPropertyDescriptor(obj, "0"); 36 37 if (!desc1.hasOwnProperty("get")) { 38 throw new Test262Error('Expected desc1.hasOwnProperty("get") to be true, actually ' + desc1.hasOwnProperty("get")); 39 } 40 41 if (!desc2.hasOwnProperty("value")) { 42 throw new Test262Error('Expected desc2.hasOwnProperty("value") to be true, actually ' + desc2.hasOwnProperty("value")); 43 } 44 45 if (typeof desc2.get !== "undefined") { 46 throw new Test262Error('Expected typeof desc2.get === "undefined", actually ' + typeof desc2.get); 47 } 48 49 if (typeof desc2.set !== "undefined") { 50 throw new Test262Error('Expected typeof desc2.set === "undefined", actually ' + typeof desc2.set); 51 } 52 53 verifyEqualTo(obj, "0", 1001); 54 55 verifyNotWritable(obj, "0"); 56 57 verifyProperty(obj, "0", { 58 enumerable: true, 59 configurable: true, 60 }); 61 62 reportCompare(0, 0);