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

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

Issue 1747933002: Fix spec-compliance bug in Array.prototype.join. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months 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
« no previous file with comments | « src/js/array.js ('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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 assertEquals("", a.join("")); 84 assertEquals("", a.join(""));
85 a[123123123] = "o"; 85 a[123123123] = "o";
86 a[1255215215] = "p"; 86 a[1255215215] = "p";
87 assertEquals("op", a.join("")); 87 assertEquals("op", a.join(""));
88 88
89 a = new Array(100001); 89 a = new Array(100001);
90 for (var i = 0; i < a.length; i++) a[i] = undefined; 90 for (var i = 0; i < a.length; i++) a[i] = undefined;
91 a[5] = "ab"; 91 a[5] = "ab";
92 a[90000] = "cd"; 92 a[90000] = "cd";
93 assertEquals("abcd", a.join("")); // Must not throw. 93 assertEquals("abcd", a.join("")); // Must not throw.
94
95
96 // Make sure that each element is accessed exactly once, and in the correct
97 // order.
98 {
99 var log = [];
100 var p = new Proxy({length: 3, 0: 'a', 1: 'b'}, {
101 get: function(t, k, r) { log.push(k); return Reflect.get(t, k, r); }
102 });
103
104 assertEquals("a,b,", Array.prototype.join.call(p));
105 assertEquals(["length", "0", "1", "2"], log);
106 }
OLDNEW
« no previous file with comments | « src/js/array.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698