Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1528)

Side by Side Diff: test/mjsunit/array-concat.js

Issue 8694: Fix issue with Array.concat not preserving holes in the (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698