tamper-with-object-keys.js (668B)
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.values 6 description: > 7 Object.values should not have its behavior impacted by modifications to Object.keys 8 author: Jordan Harband 9 ---*/ 10 11 function fakeObjectKeys() { 12 throw new Test262Error('The overriden version of Object.keys was called!'); 13 } 14 15 Object.keys = fakeObjectKeys; 16 17 assert.sameValue(Object.keys, fakeObjectKeys, 'Sanity check failed: could not modify the global Object.keys'); 18 assert.sameValue(Object.values({ 19 a: 1 20 }).length, 1, 'Expected object with 1 key to have 1 value'); 21 22 reportCompare(0, 0);