15.2.3.6-4-574.js (778B)
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-574 6 description: > 7 ES5 Attributes - [[Set]] attribute is a function which has two 8 arguments 9 ---*/ 10 11 var obj = {}; 12 var firstArg = 12; 13 var secondArg = 12; 14 15 var setFunc = function(a, b) { 16 firstArg = a; 17 secondArg = b; 18 }; 19 Object.defineProperty(obj, "prop", { 20 set: setFunc 21 }); 22 obj.prop = 100; 23 var desc = Object.getOwnPropertyDescriptor(obj, "prop"); 24 25 assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); 26 assert.sameValue(desc.set, setFunc, 'desc.set'); 27 assert.sameValue(firstArg, 100, 'firstArg'); 28 assert.sameValue(typeof secondArg, "undefined", 'typeof secondArg'); 29 30 reportCompare(0, 0);