| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 assertEquals([], a.splice(1, 0, 'a', 'b', 'c')); | 60 assertEquals([], a.splice(1, 0, 'a', 'b', 'c')); |
| 61 assertEquals([1, 'a', 'b', 'c', 2, 3], a); | 61 assertEquals([1, 'a', 'b', 'c', 2, 3], a); |
| 62 } | 62 } |
| 63 })(); | 63 })(); |
| 64 | 64 |
| 65 | 65 |
| 66 // Check various forms of arguments omission. | 66 // Check various forms of arguments omission. |
| 67 (function() { | 67 (function() { |
| 68 var array; | 68 var array; |
| 69 for (var i = 0; i < 7; i++) { | 69 for (var i = 0; i < 7; i++) { |
| 70 // SpiderMonkey and JSC return undefined in the case where no | |
| 71 // arguments are given instead of using the implicit undefined | |
| 72 // arguments. This does not follow ECMA-262, but we do the same for | |
| 73 // compatibility. | |
| 74 // TraceMonkey follows ECMA-262 though. | |
| 75 array = [1, 2, 3] | 70 array = [1, 2, 3] |
| 76 assertEquals(undefined, array.splice()); | 71 assertEquals([], array.splice()); |
| 77 assertEquals([1, 2, 3], array); | 72 assertEquals([1, 2, 3], array); |
| 78 | 73 |
| 79 // SpiderMonkey, TraceMonkey and JSC treat the case where no delete count is | 74 // SpiderMonkey, TraceMonkey and JSC treat the case where no delete count is |
| 80 // given differently from when an undefined delete count is given. | 75 // given differently from when an undefined delete count is given. |
| 81 // This does not follow ECMA-262, but we do the same for | 76 // This does not follow ECMA-262, but we do the same for |
| 82 // compatibility. | 77 // compatibility. |
| 83 array = [1, 2, 3] | 78 array = [1, 2, 3] |
| 84 assertEquals([1, 2, 3], array.splice(0)); | 79 assertEquals([1, 2, 3], array.splice(0)); |
| 85 assertEquals([], array); | 80 assertEquals([], array); |
| 86 | 81 |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 359 |
| 365 (function() { | 360 (function() { |
| 366 for (var i = 0; i < 7; i++) { | 361 for (var i = 0; i < 7; i++) { |
| 367 var a = [7, 8, 9]; | 362 var a = [7, 8, 9]; |
| 368 a.splice(0, 0, 1, 2, 3, 4, 5, 6); | 363 a.splice(0, 0, 1, 2, 3, 4, 5, 6); |
| 369 assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], a); | 364 assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], a); |
| 370 assertFalse(a.hasOwnProperty(10), "a.hasOwnProperty(10)"); | 365 assertFalse(a.hasOwnProperty(10), "a.hasOwnProperty(10)"); |
| 371 assertEquals(undefined, a[10]); | 366 assertEquals(undefined, a[10]); |
| 372 } | 367 } |
| 373 })(); | 368 })(); |
| OLD | NEW |