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

Unified Diff: test/mjsunit/es6/typedarray.js

Issue 2096873002: Amends the TypedArray constructor to use the path for primitives for all (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/js/typedarray.js ('k') | test/test262/test262.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/typedarray.js
diff --git a/test/mjsunit/es6/typedarray.js b/test/mjsunit/es6/typedarray.js
index 4bdf8226a8551c0fa250ffcdeb2c3f99b5ce08a1..b1bd8937bea07e0028759b33fa4334043db99bb8 100644
--- a/test/mjsunit/es6/typedarray.js
+++ b/test/mjsunit/es6/typedarray.js
@@ -229,6 +229,27 @@ function TestTypedArray(constr, elementSize, typicalElement) {
RangeError);
}
+ var aFromUndef = new constr();
+ assertSame(elementSize, aFromUndef.BYTES_PER_ELEMENT);
+ assertSame(0, aFromUndef.length);
+ assertSame(0*elementSize, aFromUndef.byteLength);
+ assertSame(0, aFromUndef.byteOffset);
+ assertSame(0*elementSize, aFromUndef.buffer.byteLength);
+
+ var aFromNull = new constr(null);
+ assertSame(elementSize, aFromNull.BYTES_PER_ELEMENT);
+ assertSame(0, aFromNull.length);
+ assertSame(0*elementSize, aFromNull.byteLength);
+ assertSame(0, aFromNull.byteOffset);
+ assertSame(0*elementSize, aFromNull.buffer.byteLength);
+
+ var aFromBool = new constr(true);
+ assertSame(elementSize, aFromBool.BYTES_PER_ELEMENT);
+ assertSame(1, aFromBool.length);
+ assertSame(1*elementSize, aFromBool.byteLength);
+ assertSame(0, aFromBool.byteOffset);
+ assertSame(1*elementSize, aFromBool.buffer.byteLength);
+
var aFromString = new constr("30");
assertSame(elementSize, aFromString.BYTES_PER_ELEMENT);
assertSame(30, aFromString.length);
@@ -236,6 +257,8 @@ function TestTypedArray(constr, elementSize, typicalElement) {
assertSame(0, aFromString.byteOffset);
assertSame(30*elementSize, aFromString.buffer.byteLength);
+ assertThrows(function() { new constr(Symbol()); }, TypeError);
+
var jsArray = [];
for (i = 0; i < 30; i++) {
jsArray.push(typicalElement);
« no previous file with comments | « src/js/typedarray.js ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698