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

Side by Side Diff: test/mjsunit/harmony/typedarray-findindex.js

Issue 1130413010: Test that TypedArray methods don't read length (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-arrays 5 // Flags: --harmony-arrays
6 6
7 var typedArrayConstructors = [ 7 var typedArrayConstructors = [
8 Uint8Array, 8 Uint8Array,
9 Int8Array, 9 Int8Array,
10 Uint16Array, 10 Uint16Array,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 assertThrows('new constructor([]).findIndex(null)', TypeError); 169 assertThrows('new constructor([]).findIndex(null)', TypeError);
170 assertThrows('new constructor([]).findIndex(undefined)', TypeError); 170 assertThrows('new constructor([]).findIndex(undefined)', TypeError);
171 assertThrows('new constructor([]).findIndex(0)', TypeError); 171 assertThrows('new constructor([]).findIndex(0)', TypeError);
172 assertThrows('new constructor([]).findIndex(true)', TypeError); 172 assertThrows('new constructor([]).findIndex(true)', TypeError);
173 assertThrows('new constructor([]).findIndex(false)', TypeError); 173 assertThrows('new constructor([]).findIndex(false)', TypeError);
174 assertThrows('new constructor([]).findIndex("")', TypeError); 174 assertThrows('new constructor([]).findIndex("")', TypeError);
175 assertThrows('new constructor([]).findIndex({})', TypeError); 175 assertThrows('new constructor([]).findIndex({})', TypeError);
176 assertThrows('new constructor([]).findIndex([])', TypeError); 176 assertThrows('new constructor([]).findIndex([])', TypeError);
177 assertThrows('new constructor([]).findIndex(/\d+/)', TypeError); 177 assertThrows('new constructor([]).findIndex(/\d+/)', TypeError);
178 178
179 // Shadowing length doesn't affect findIndex, unlike Array.prototype.findIndex
180 a = new constructor([1, 2]);
181 Object.defineProperty(a, 'length', {value: 1});
182 var x = 0;
183 assertEquals(a.findIndex(function(elt) { x += elt; return false; }), -1);
184 assertEquals(x, 3);
185 assertEquals(Array.prototype.findIndex.call(a,
186 function(elt) { x += elt; return false; }), -1);
187 assertEquals(x, 4);
188
179 } 189 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698