| 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 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 // Check that splicing array of holes keeps it as array of holes | 28 // Check that splicing array of holes keeps it as array of holes |
| 29 (function() { | 29 (function() { |
| 30 for (var i = 0; i < 7; i++) { | 30 for (var i = 0; i < 7; i++) { |
| 31 var array = new Array(10); | 31 var array = new Array(10); |
| 32 var spliced = array.splice(1, 1, 'one', 'two'); | 32 var spliced = array.splice(1, 1, 'one', 'two'); |
| 33 assertEquals(1, spliced.length); | 33 assertEquals(1, spliced.length); |
| 34 assertFalse(0 in spliced, "0 in spliced"); | 34 assertFalse(0 in spliced, "0 in spliced: " + spliced); |
| 35 | 35 |
| 36 assertEquals(11, array.length); | 36 assertEquals(11, array.length); |
| 37 assertFalse(0 in array, "0 in array"); | 37 assertFalse(0 in array, "0 in array: " + 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, "3 in array"); | 40 assertFalse(3 in array, "3 in array: " + array); |
| 41 } | 41 } |
| 42 })(); | 42 })(); |
| 43 | 43 |
| 44 | 44 |
| 45 // Check various variants of empty array's splicing. | 45 // Check various variants of empty array's splicing. |
| 46 (function() { | 46 (function() { |
| 47 for (var i = 0; i < 7; i++) { | 47 for (var i = 0; i < 7; i++) { |
| 48 assertEquals([], [].splice(0, 0)); | 48 assertEquals([], [].splice(0, 0)); |
| 49 assertEquals([], [].splice(1, 0)); | 49 assertEquals([], [].splice(1, 0)); |
| 50 assertEquals([], [].splice(0, 1)); | 50 assertEquals([], [].splice(0, 1)); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 311 |
| 312 (function() { | 312 (function() { |
| 313 for (var i = 0; i < 7; i++) { | 313 for (var i = 0; i < 7; i++) { |
| 314 var a = [7, 8, 9]; | 314 var a = [7, 8, 9]; |
| 315 a.splice(0, 0, 1, 2, 3, 4, 5, 6); | 315 a.splice(0, 0, 1, 2, 3, 4, 5, 6); |
| 316 assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], a); | 316 assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], a); |
| 317 assertFalse(a.hasOwnProperty(10), "a.hasOwnProperty(10)"); | 317 assertFalse(a.hasOwnProperty(10), "a.hasOwnProperty(10)"); |
| 318 assertEquals(undefined, a[10]); | 318 assertEquals(undefined, a[10]); |
| 319 } | 319 } |
| 320 })(); | 320 })(); |
| OLD | NEW |