15.2.3.6-4-532.js (1021B)
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-532 6 description: > 7 ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a 8 Function, [[Enumerable]] is true, [[Configurable]] is true) is 9 enumerable 10 ---*/ 11 12 var propertyFound = false; 13 14 var obj = {}; 15 16 var getFunc = function() { 17 return 1001; 18 }; 19 20 var verifySetFunc = "data"; 21 var setFunc = function(value) { 22 verifySetFunc = value; 23 }; 24 25 Object.defineProperty(obj, "prop", { 26 get: getFunc, 27 set: setFunc, 28 enumerable: true, 29 configurable: true 30 }); 31 32 var propertyDefineCorrect = obj.hasOwnProperty("prop"); 33 var desc = Object.getOwnPropertyDescriptor(obj, "prop"); 34 35 for (var p in obj) { 36 if (p === "prop") { 37 propertyFound = true; 38 break; 39 } 40 } 41 42 assert(propertyFound, 'Property not found'); 43 assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); 44 assert.sameValue(desc.enumerable, true, 'desc.enumerable'); 45 46 reportCompare(0, 0);