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

Side by Side Diff: test/mjsunit/harmony/typedarray-fill.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
« no previous file with comments | « no previous file | test/mjsunit/harmony/typedarray-find.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 18 matching lines...) Expand all
29 assertArrayEquals(new constructor([0, 0, 0, 0, 0]).fill(8, -3, 42), [0, 0, 8, 8, 8]); 29 assertArrayEquals(new constructor([0, 0, 0, 0, 0]).fill(8, -3, 42), [0, 0, 8, 8, 8]);
30 assertArrayEquals(new constructor([0, 0, 0, 0, 0]).fill(8, -3, 4), [0, 0, 8, 8 , 0]); 30 assertArrayEquals(new constructor([0, 0, 0, 0, 0]).fill(8, -3, 4), [0, 0, 8, 8 , 0]);
31 assertArrayEquals(new constructor([0, 0, 0, 0, 0]).fill(8, -2, -1), [0, 0, 0, 8, 0]); 31 assertArrayEquals(new constructor([0, 0, 0, 0, 0]).fill(8, -2, -1), [0, 0, 0, 8, 0]);
32 assertArrayEquals(new constructor([0, 0, 0, 0, 0]).fill(8, -1, -3), [0, 0, 0, 0, 0]); 32 assertArrayEquals(new constructor([0, 0, 0, 0, 0]).fill(8, -1, -3), [0, 0, 0, 0, 0]);
33 assertArrayEquals(new constructor([0, 0, 0, 0, 0]).fill(8, 0, 4), [8, 8, 8, 8, 0]); 33 assertArrayEquals(new constructor([0, 0, 0, 0, 0]).fill(8, 0, 4), [8, 8, 8, 8, 0]);
34 34
35 // Test exceptions 35 // Test exceptions
36 assertThrows('constructor.prototype.fill.call(null)', TypeError); 36 assertThrows('constructor.prototype.fill.call(null)', TypeError);
37 assertThrows('constructor.prototype.fill.call(undefined)', TypeError); 37 assertThrows('constructor.prototype.fill.call(undefined)', TypeError);
38 assertThrows('constructor.prototype.fill.call([])', TypeError); 38 assertThrows('constructor.prototype.fill.call([])', TypeError);
39
40 // Shadowing length doesn't affect fill, unlike Array.prototype.fill
41 var a = new constructor([2, 2]);
42 Object.defineProperty(a, 'length', {value: 1});
arv (Not doing code reviews) 2015/05/15 00:25:47 or get: function() { assertUnreachable(); }
dehrenberg 2015/05/15 01:40:41 well, later down I validate the test by making it
43 a.fill(3);
44 assertArrayEquals([a[0], a[1]], [3, 3]);
45 Array.prototype.fill.call(a, 4);
46 assertArrayEquals([a[0], a[1]], [4, 3]);
39 } 47 }
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/typedarray-find.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698