symbols-omitted.js (927B)
1 // Copyright (C) 2015 Jordan Harband. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-object.entries 6 description: Object.entries does not include Symbol keys. 7 author: Jordan Harband 8 features: [Symbol] 9 ---*/ 10 11 var value = {}; 12 var enumSym = Symbol('enum'); 13 var nonEnumSym = Symbol('nonenum'); 14 var symValue = Symbol('value'); 15 16 var obj = { 17 key: symValue 18 }; 19 obj[enumSym] = value; 20 Object.defineProperty(obj, nonEnumSym, { 21 enumerable: false, 22 value: value 23 }); 24 25 var result = Object.entries(obj); 26 27 assert.sameValue(Array.isArray(result), true, 'result is an array'); 28 assert.sameValue(result.length, 1, 'result has 1 item'); 29 30 assert.sameValue(Array.isArray(result[0]), true, 'first entry is an array'); 31 32 assert.sameValue(result[0][0], 'key', 'first entry has key "key"'); 33 assert.sameValue(result[0][1], symValue, 'first entry has value `symValue`'); 34 35 reportCompare(0, 0);