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

Side by Side Diff: test/mjsunit/harmony/typedarrays.js

Issue 19210002: Throw if first argument to TypedArray.set is a number. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« src/typedarray.js ('K') | « test/mjsunit/external-array-no-sse2.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 a61.set(a62) 451 a61.set(a62)
452 assertArrayPrefix([1, 12], a61) 452 assertArrayPrefix([1, 12], a61)
453 453
454 // Invalid source 454 // Invalid source
455 var a = new Uint16Array(50); 455 var a = new Uint16Array(50);
456 var expected = []; 456 var expected = [];
457 for (i = 0; i < 50; i++) { 457 for (i = 0; i < 50; i++) {
458 a[i] = i; 458 a[i] = i;
459 expected.push(i); 459 expected.push(i);
460 } 460 }
461 a.set(0);
462 assertArrayPrefix(expected, a);
463 a.set({}); 461 a.set({});
464 assertArrayPrefix(expected, a); 462 assertArrayPrefix(expected, a);
465 assertThrows(function() { a.set.call({}) }, TypeError); 463 assertThrows(function() { a.set.call({}) }, TypeError);
466 assertThrows(function() { a.set.call([]) }, TypeError); 464 assertThrows(function() { a.set.call([]) }, TypeError);
465
466 assertThrows(function() { a.set(0); }, TypeError);
467 assertThrows(function() { a.set(0, 1); }, TypeError);
467 } 468 }
468 469
469 TestTypedArraySet(); 470 TestTypedArraySet();
470 471
471 // DataView 472 // DataView
472 function TestDataViewConstructor() { 473 function TestDataViewConstructor() {
473 var ab = new ArrayBuffer(256); 474 var ab = new ArrayBuffer(256);
474 475
475 var d1 = new DataView(ab, 1, 255); 476 var d1 = new DataView(ab, 1, 255);
476 assertSame(ab, d1.buffer); 477 assertSame(ab, d1.buffer);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 TestArbitrary(new ArrayBuffer(256)); 571 TestArbitrary(new ArrayBuffer(256));
571 for(i = 0; i < typedArrayConstructors.lenght; i++) { 572 for(i = 0; i < typedArrayConstructors.lenght; i++) {
572 TestArbitary(new typedArrayConstructors[i](10)); 573 TestArbitary(new typedArrayConstructors[i](10));
573 } 574 }
574 TestArbitrary(new DataView(new ArrayBuffer(256))); 575 TestArbitrary(new DataView(new ArrayBuffer(256)));
575 576
576 577
577 // Test direct constructor call 578 // Test direct constructor call
578 assertThrows(function() { ArrayBuffer(); }, TypeError); 579 assertThrows(function() { ArrayBuffer(); }, TypeError);
579 assertThrows(function() { DataView(new ArrayBuffer()); }, TypeError); 580 assertThrows(function() { DataView(new ArrayBuffer()); }, TypeError);
OLDNEW
« src/typedarray.js ('K') | « test/mjsunit/external-array-no-sse2.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698