| Index: test/mjsunit/harmony/typedarrays.js
|
| diff --git a/test/mjsunit/harmony/typedarrays.js b/test/mjsunit/harmony/typedarrays.js
|
| index 6448938a80071b15afc54ce42222a84666fa1c08..1e0147633f20616f30e6e6d9e04d57d58397c0d8 100644
|
| --- a/test/mjsunit/harmony/typedarrays.js
|
| +++ b/test/mjsunit/harmony/typedarrays.js
|
| @@ -323,6 +323,7 @@ function TestTypedArrayOutOfRange(constructor, value, result) {
|
|
|
| TestTypedArrayOutOfRange(Uint8Array, 0x1FA, 0xFA);
|
| TestTypedArrayOutOfRange(Uint8Array, -1, 0xFF);
|
| +
|
| TestTypedArrayOutOfRange(Int8Array, 0x1FA, 0x7A - 0x80);
|
|
|
| TestTypedArrayOutOfRange(Uint16Array, 0x1FFFA, 0xFFFA);
|
| @@ -336,28 +337,38 @@ TestTypedArrayOutOfRange(Int32Array, 0x1FFFFFFFA, 0x7FFFFFFA - 0x80000000);
|
| TestTypedArrayOutOfRange(Uint8ClampedArray, 0x1FA, 0xFF);
|
| TestTypedArrayOutOfRange(Uint8ClampedArray, -1, 0);
|
|
|
| +var typedArrayConstructors = [
|
| + Uint8Array,
|
| + Int8Array,
|
| + Uint16Array,
|
| + Int16Array,
|
| + Uint32Array,
|
| + Int32Array,
|
| + Uint8ClampedArray,
|
| + Float32Array,
|
| + Float64Array]
|
| function TestPropertyTypeChecks(constructor) {
|
| - function CheckThrows(name) {
|
| + var a = new constructor();
|
| + function CheckProperty(name) {
|
| var d = Object.getOwnPropertyDescriptor(constructor.prototype, name);
|
| var o = {}
|
| assertThrows(function() {d.get.call(o);}, TypeError);
|
| + d.get.call(a); // shouldn't throw
|
| + for (var i = 0 ; i < typedArrayConstructors.length; i++) {
|
| + d.get.call(new typedArrayConstructors[i](10));
|
| + }
|
| }
|
|
|
| - CheckThrows("buffer");
|
| - CheckThrows("byteOffset");
|
| - CheckThrows("byteLength");
|
| - CheckThrows("length");
|
| + CheckProperty("buffer");
|
| + CheckProperty("byteOffset");
|
| + CheckProperty("byteLength");
|
| + CheckProperty("length");
|
| +}
|
| +
|
| +for(i = 0; i < typedArrayConstructors.lenght; i++) {
|
| + TestPropertyTypeChecks(typedArrayConstructors[i]);
|
| }
|
|
|
| -TestPropertyTypeChecks(Uint8Array);
|
| -TestPropertyTypeChecks(Int8Array);
|
| -TestPropertyTypeChecks(Uint16Array);
|
| -TestPropertyTypeChecks(Int16Array);
|
| -TestPropertyTypeChecks(Uint32Array);
|
| -TestPropertyTypeChecks(Int32Array);
|
| -TestPropertyTypeChecks(Uint8ClampedArray);
|
| -TestPropertyTypeChecks(Float32Array);
|
| -TestPropertyTypeChecks(Float64Array);
|
|
|
| // General tests for properties
|
|
|
| @@ -374,14 +385,9 @@ function TestEnumerable(func, obj) {
|
| assertArrayEquals([], props(obj));
|
| }
|
| TestEnumerable(ArrayBuffer, new ArrayBuffer());
|
| -TestEnumerable(Uint8Array);
|
| -TestEnumerable(Int8Array);
|
| -TestEnumerable(Uint16Array);
|
| -TestEnumerable(Int16Array);
|
| -TestEnumerable(Uint32Array);
|
| -TestEnumerable(Int32Array);
|
| -TestEnumerable(Float32Array);
|
| -TestEnumerable(Uint8ClampedArray);
|
| +for(i = 0; i < typedArrayConstructors.lenght; i++) {
|
| + TestEnumerable(typedArrayConstructors[i]);
|
| +}
|
|
|
| // Test arbitrary properties on ArrayBuffer
|
| function TestArbitrary(m) {
|
| @@ -395,6 +401,11 @@ function TestArbitrary(m) {
|
| }
|
| }
|
| TestArbitrary(new ArrayBuffer(256));
|
| +for(i = 0; i < typedArrayConstructors.lenght; i++) {
|
| + TestArbitary(new typedArrayConstructors[i](10));
|
| +}
|
| +
|
| +
|
|
|
| // Test direct constructor call
|
| assertTrue(ArrayBuffer() instanceof ArrayBuffer);
|
|
|