Index: test/mjsunit/es6/typedarray-proto.js |
diff --git a/test/mjsunit/es6/typedarray-proto.js b/test/mjsunit/es6/typedarray-proto.js |
index 0bd90d13b404ca7befbac7817c8e688addf51f39..558cb0ad7a25304b19c8d9fb41e893eba2c6195f 100644 |
--- a/test/mjsunit/es6/typedarray-proto.js |
+++ b/test/mjsunit/es6/typedarray-proto.js |
@@ -4,10 +4,12 @@ |
// Test that the methods for different TypedArray types have the same |
// identity. |
+// TODO(dehrenberg): Test that the TypedArray proto hierarchy is set |
+// up properly. |
+// TODO(dehrenberg): subarray is currently left out because that still |
+// uses per-type methods. When that's fixed, stop leaving it out. |
-'use strict'; |
- |
-let typedArrayConstructors = [ |
+var typedArrayConstructors = [ |
Uint8Array, |
Int8Array, |
Uint16Array, |
@@ -18,18 +20,6 @@ |
Float32Array, |
Float64Array]; |
-let TypedArray = Uint8Array.__proto__; |
-let TypedArrayPrototype = TypedArray.prototype; |
- |
-assertEquals(TypedArray.__proto__, Function.prototype); |
-assertEquals(TypedArrayPrototype.__proto__, Object.prototype); |
- |
-// There are extra own class properties due to it simply being a function |
-let classProperties = new Set([ |
- "length", "name", "arguments", "caller", "prototype", "BYTES_PER_ELEMENT" |
-]); |
-let instanceProperties = new Set(["BYTES_PER_ELEMENT", "constructor", "prototype"]); |
- |
function functionProperties(object) { |
return Object.getOwnPropertyNames(object).filter(function(name) { |
return typeof Object.getOwnPropertyDescriptor(object, name).value |
@@ -38,33 +28,15 @@ |
}); |
} |
-let typedArrayMethods = functionProperties(Uint8Array.prototype); |
-let typedArrayClassMethods = functionProperties(Uint8Array); |
+var typedArrayMethods = functionProperties(Uint8Array.prototype); |
+var typedArrayClassMethods = functionProperties(Uint8Array); |
-for (let constructor of typedArrayConstructors) { |
- for (let property of Object.getOwnPropertyNames(constructor.prototype)) { |
- assertTrue(instanceProperties.has(property), property); |
+for (var constructor of typedArrayConstructors) { |
+ for (var method of typedArrayMethods) { |
+ assertEquals(constructor.prototype[method], |
+ Uint8Array.prototype[method], method); |
} |
- for (let property of Object.getOwnPropertyNames(constructor)) { |
- assertTrue(classProperties.has(property), property); |
+ for (var classMethod of typedArrayClassMethods) { |
+ assertEquals(constructor[method], Uint8Array[method], classMethod); |
} |
} |
- |
-// Abstract %TypedArray% class can't be constructed directly |
- |
-assertThrows(() => new TypedArray(), TypeError); |
- |
-// The "prototype" property is nonconfigurable, nonenumerable, nonwritable, |
-// both for %TypedArray% and for all subclasses |
- |
-let desc = Object.getOwnPropertyDescriptor(TypedArray, "prototype"); |
-assertFalse(desc.writable); |
-assertFalse(desc.configurable); |
-assertFalse(desc.enumerable); |
- |
-for (let constructor of typedArrayConstructors) { |
- let desc = Object.getOwnPropertyDescriptor(constructor, "prototype"); |
- assertFalse(desc.writable); |
- assertFalse(desc.configurable); |
- assertFalse(desc.enumerable); |
-} |