OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 17 matching lines...) Expand all Loading... |
28 var pow30 = Math.pow(2, 30); | 28 var pow30 = Math.pow(2, 30); |
29 var pow31 = Math.pow(2, 31); | 29 var pow31 = Math.pow(2, 31); |
30 | 30 |
31 var a = []; | 31 var a = []; |
32 a[pow31] = 31; | 32 a[pow31] = 31; |
33 | 33 |
34 assertEquals(pow31 + 1, a.length); | 34 assertEquals(pow31 + 1, a.length); |
35 assertThrows(function() { a.concat(a); }, RangeError); | 35 assertThrows(function() { a.concat(a); }, RangeError); |
36 | 36 |
37 var b = []; | 37 var b = []; |
38 b[pow31 - 2] = 32; | 38 b[pow31 - 3] = 32; |
| 39 b[pow31 - 2] = "out_of_bounds"; |
39 var ab = a.concat(b); | 40 var ab = a.concat(b); |
40 assertEquals(2 * pow31 - 1, ab.length); | 41 assertEquals(2 * pow31 - 1, ab.length); |
41 assertEquals(31, ab[pow31]); | 42 assertEquals(31, ab[pow31]); |
42 assertEquals(32, ab[2 * pow31 - 1]); | 43 assertEquals(32, ab[2 * pow31 - 2]); |
| 44 assertEquals(undefined, ab[2 * pow31 - 1]); |
43 | 45 |
44 var c = []; | 46 var c = []; |
45 c[pow30] = 30; | 47 c[pow30] = 30; |
46 assertThrows(function() { c.concat(c, a); }, RangeError); | 48 assertThrows(function() { c.concat(c, a); }, RangeError); |
OLD | NEW |