| OLD | NEW |
| 1 // Copyright (c) 2006 Apple Computer, Inc. All rights reserved. | 1 // Copyright (c) 2006 Apple Computer, Inc. All rights reserved. |
| 2 // | 2 // |
| 3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
| 4 // modification, are permitted provided that the following conditions | 4 // modification, are permitted provided that the following conditions |
| 5 // are met: | 5 // are met: |
| 6 // | 6 // |
| 7 // 1. Redistributions of source code must retain the above copyright | 7 // 1. Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
| 9 // | 9 // |
| 10 // 2. Redistributions in binary form must reproduce the above | 10 // 2. Redistributions in binary form must reproduce the above |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 assertEquals(Object.keys({__proto__:{a:null}}), []); | 47 assertEquals(Object.keys({__proto__:{a:null}}), []); |
| 48 assertEquals(Object.keys({__proto__:[1,2,3]}), []); | 48 assertEquals(Object.keys({__proto__:[1,2,3]}), []); |
| 49 var x = []; | 49 var x = []; |
| 50 x.__proto__ = [1, 2, 3]; | 50 x.__proto__ = [1, 2, 3]; |
| 51 assertEquals(Object.keys(x), []); | 51 assertEquals(Object.keys(x), []); |
| 52 assertEquals(Object.keys(function () {}), []); | 52 assertEquals(Object.keys(function () {}), []); |
| 53 | 53 |
| 54 assertEquals('string', typeof(Object.keys([1])[0])); | 54 assertEquals('string', typeof(Object.keys([1])[0])); |
| 55 | 55 |
| 56 function argsTest(a, b, c) { | 56 function argsTest(a, b, c) { |
| 57 assertEquals([0, 1, 2], Object.keys(arguments)); | 57 assertEquals(['0', '1', '2'], Object.keys(arguments)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 argsTest(1, 2, 3); | 60 argsTest(1, 2, 3); |
| 61 | 61 |
| 62 var literal = {a: 1, b: 2, c: 3}; | 62 var literal = {a: 1, b: 2, c: 3}; |
| 63 var keysBefore = Object.keys(literal); | 63 var keysBefore = Object.keys(literal); |
| 64 assertEquals(['a', 'b', 'c'], keysBefore); | 64 assertEquals(['a', 'b', 'c'], keysBefore); |
| 65 keysBefore[0] = 'x'; | 65 keysBefore[0] = 'x'; |
| 66 var keysAfter = Object.keys(literal); | 66 var keysAfter = Object.keys(literal); |
| 67 assertEquals(['a', 'b', 'c'], keysAfter); | 67 assertEquals(['a', 'b', 'c'], keysAfter); |
| 68 assertEquals(['x', 'b', 'c'], keysBefore); | 68 assertEquals(['x', 'b', 'c'], keysBefore); |
| OLD | NEW |