OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 assertEquals("undefined", typeof(c[0xffffffff])); | 100 assertEquals("undefined", typeof(c[0xffffffff])); |
101 assertEquals(c.length, a.length + 1); | 101 assertEquals(c.length, a.length + 1); |
102 | 102 |
103 } | 103 } |
104 | 104 |
105 a = []; | 105 a = []; |
106 c = a.concat('Hello'); | 106 c = a.concat('Hello'); |
107 assertEquals(1, c.length); | 107 assertEquals(1, c.length); |
108 assertEquals("Hello", c[0]); | 108 assertEquals("Hello", c[0]); |
109 assertEquals("Hello", c.toString()); | 109 assertEquals("Hello", c.toString()); |
| 110 |
| 111 // Check that concat preserves holes. |
| 112 var holey = [void 0,'a',,'c'].concat(['d',,'f',[0,,2],void 0]) |
| 113 assertEquals(9, holey.length); // hole in embedded array is ignored |
| 114 for (var i = 0; i < holey.length; i++) { |
| 115 if (i == 2 || i == 5) { |
| 116 assertFalse(i in holey); |
| 117 } else { |
| 118 assertTrue(i in holey); |
| 119 } |
| 120 } |
OLD | NEW |