| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 assertEquals(11, array.length); | 36 assertEquals(11, array.length); |
| 37 assertFalse(0 in array); | 37 assertFalse(0 in array); |
| 38 assertTrue(1 in array); | 38 assertTrue(1 in array); |
| 39 assertTrue(2 in array); | 39 assertTrue(2 in array); |
| 40 assertFalse(3 in array); | 40 assertFalse(3 in array); |
| 41 } | 41 } |
| 42 })(); | 42 })(); |
| 43 | 43 |
| 44 | 44 |
| 45 // Check various variants of empty array's splicing. |
| 46 (function() { |
| 47 for (var i = 0; i < 7; i++) { |
| 48 assertEquals([], [].splice(0, 0)); |
| 49 assertEquals([], [].splice(1, 0)); |
| 50 assertEquals([], [].splice(0, 1)); |
| 51 assertEquals([], [].splice(-1, 0)); |
| 52 } |
| 53 })(); |
| 54 |
| 55 |
| 45 // Check various forms of arguments omission. | 56 // Check various forms of arguments omission. |
| 46 (function() { | 57 (function() { |
| 47 var array; | 58 var array; |
| 48 for (var i = 0; i < 7; i++) { | 59 for (var i = 0; i < 7; i++) { |
| 49 // SpiderMonkey and JSC return undefined in the case where no | 60 // SpiderMonkey and JSC return undefined in the case where no |
| 50 // arguments are given instead of using the implicit undefined | 61 // arguments are given instead of using the implicit undefined |
| 51 // arguments. This does not follow ECMA-262, but we do the same for | 62 // arguments. This does not follow ECMA-262, but we do the same for |
| 52 // compatibility. | 63 // compatibility. |
| 53 // TraceMonkey follows ECMA-262 though. | 64 // TraceMonkey follows ECMA-262 though. |
| 54 array = [1, 2, 3] | 65 array = [1, 2, 3] |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 301 |
| 291 (function() { | 302 (function() { |
| 292 for (var i = 0; i < 7; i++) { | 303 for (var i = 0; i < 7; i++) { |
| 293 var a = [7, 8, 9]; | 304 var a = [7, 8, 9]; |
| 294 a.splice(0, 0, 1, 2, 3, 4, 5, 6); | 305 a.splice(0, 0, 1, 2, 3, 4, 5, 6); |
| 295 assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], a); | 306 assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], a); |
| 296 assertFalse(a.hasOwnProperty(10)); | 307 assertFalse(a.hasOwnProperty(10)); |
| 297 assertEquals(undefined, a[10]); | 308 assertEquals(undefined, a[10]); |
| 298 } | 309 } |
| 299 })(); | 310 })(); |
| OLD | NEW |