Home | History | Annotate | Download | only in mjsunit

Lines Matching refs:array

28 // Check that slicing array of holes keeps it as array of holes
30 var array = new Array(10);
32 var sliced = array.slice();
33 assertEquals(array.length, sliced.length);
41 var array = new Array(7);
44 assertEquals(array, array.slice());
45 assertEquals(array, array.slice(0));
46 assertEquals(array, array.slice(undefined));
47 assertEquals(array, array.slice("foobar"));
48 assertEquals(array, array.slice(undefined, undefined));
55 var array = new Array(7);
58 assertEquals(7, array.slice(-100).length);
59 assertEquals(3, array.slice(-3).length);
60 assertEquals(3, array.slice(4).length);
61 assertEquals(1, array.slice(6).length);
62 assertEquals(0, array.slice(7).length);
63 assertEquals(0, array.slice(8).length);
64 assertEquals(0, array.slice(100).length);
66 assertEquals(0, array.slice(0, -100).length);
67 assertEquals(4, array.slice(0, -3).length);
68 assertEquals(4, array.slice(0, 4).length);
69 assertEquals(6, array.slice(0, 6).length);
70 assertEquals(7, array.slice(0, 7).length);
71 assertEquals(7, array.slice(0, 8).length);
72 assertEquals(7, array.slice(0, 100).length);
79 assertEquals(7, array.slice(0, 7, obj, null, undefined).length);
82 assertEquals(1, array.slice({valueOf: function() { return 1; }},
87 assertEquals(7, array.slice(0, obj).length);
96 // Nasty: modify the array in ToInteger.
98 var array = [];
100 bad_guy = { valueOf: function() { array.push(array.length); return -1; } };
103 var sliced = array.slice(bad_guy);
105 assertEquals(expected, array);
111 // Actually out of array [0..i] we get [i - 1] as length is i.
118 // Now check the case with array of holes and some elements on prototype.
121 var array = new Array(len);
127 Array.prototype[3] = at3;
128 Array.prototype[7] = at7;
130 assertEquals(len, array.length);
131 for (var i = 0; i < array.length; i++) {
132 assertEquals(array[i], Array.prototype[i]);
135 var sliced = array.slice();
139 assertTrue(delete Array.prototype[3]);
140 assertTrue(delete Array.prototype[7]);
142 // Note that slice copies values from prototype into the array.
143 assertEquals(array[3], undefined);
144 assertFalse(array.hasOwnProperty(3));
148 assertEquals(array[7], undefined);
149 assertFalse(array.hasOwnProperty(7));
154 Array.prototype[5] = "@5";
155 assertEquals(array[5], Array.prototype[5]);
156 assertFalse(array.hasOwnProperty(5));
157 assertEquals(sliced[5], Array.prototype[5]);
160 assertTrue(delete Array.prototype[5]);