15.2.3.7-6-a-110.js (984B)
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.7-6-a-110 6 description: > 7 Object.defineProperties - all own properties (data property and 8 accessor property) 9 includes: [propertyHelper.js] 10 ---*/ 11 12 13 var obj = {}; 14 15 function get_func() { 16 return 10; 17 } 18 19 function set_func(value) { 20 obj.setVerifyHelpProp = value; 21 } 22 23 var properties = { 24 foo1: { 25 value: 200, 26 enumerable: true, 27 writable: true, 28 configurable: true 29 }, 30 foo2: { 31 get: get_func, 32 set: set_func, 33 enumerable: true, 34 configurable: true 35 } 36 }; 37 38 Object.defineProperties(obj, properties); 39 40 verifyProperty(obj, "foo1", { 41 value: 200, 42 writable: true, 43 enumerable: true, 44 configurable: true, 45 }); 46 47 verifyEqualTo(obj, "foo2", get_func()); 48 49 verifyWritable(obj, "foo2", "setVerifyHelpProp"); 50 51 verifyProperty(obj, "foo2", { 52 enumerable: true, 53 configurable: true, 54 }); 55 56 reportCompare(0, 0);