| Index: test/mjsunit/harmony/typedarrays.js
|
| diff --git a/test/mjsunit/harmony/typedarrays.js b/test/mjsunit/harmony/typedarrays.js
|
| index c70d8e5ea4b82371d7570bafdac12585885ccf6c..a4d6e7927a2b257dc7fcec23757a4e2ac5c6d9db 100644
|
| --- a/test/mjsunit/harmony/typedarrays.js
|
| +++ b/test/mjsunit/harmony/typedarrays.js
|
| @@ -25,6 +25,8 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| +// Flags: --harmony-tostring
|
| +
|
| // ArrayBuffer
|
|
|
| function TestByteLength(param, expectedByteLength) {
|
| @@ -52,6 +54,8 @@ function TestArrayBufferCreation() {
|
|
|
| var ab = new ArrayBuffer();
|
| assertSame(0, ab.byteLength);
|
| + assertEquals("[object ArrayBuffer]",
|
| + Object.prototype.toString.call(ab));
|
| }
|
|
|
| TestArrayBufferCreation();
|
| @@ -123,6 +127,9 @@ function TestTypedArray(constr, elementSize, typicalElement) {
|
| var ab = new ArrayBuffer(256*elementSize);
|
|
|
| var a0 = new constr(30);
|
| + assertEquals("[object " + constr.name + "]",
|
| + Object.prototype.toString.call(a0));
|
| +
|
| assertTrue(ArrayBuffer.isView(a0));
|
| assertSame(elementSize, a0.BYTES_PER_ELEMENT);
|
| assertSame(30, a0.length);
|
| @@ -258,6 +265,17 @@ function TestTypedArray(constr, elementSize, typicalElement) {
|
| assertSame(0, aNoParam.length);
|
| assertSame(0, aNoParam.byteLength);
|
| assertSame(0, aNoParam.byteOffset);
|
| +
|
| + var a = new constr(ab, 64*elementSize, 128);
|
| + assertEquals("[object " + constr.name + "]",
|
| + Object.prototype.toString.call(a));
|
| + var desc = Object.getOwnPropertyDescriptor(
|
| + constr.prototype, Symbol.toStringTag);
|
| + assertTrue(desc.configurable);
|
| + assertFalse(desc.enumerable);
|
| + assertFalse(!!desc.writable);
|
| + assertFalse(!!desc.set);
|
| + assertEquals("function", typeof desc.get);
|
| }
|
|
|
| TestTypedArray(Uint8Array, 1, 0xFF);
|
| @@ -500,6 +518,13 @@ function TestTypedArraysWithIllegalIndices() {
|
| assertEquals(10, a["-1e2"]);
|
| assertEquals(undefined, a[-1e2]);
|
|
|
| + a["-0"] = 256;
|
| + var s2 = " -0";
|
| + a[s2] = 255;
|
| + assertEquals(undefined, a["-0"]);
|
| + assertEquals(255, a[s2]);
|
| + assertEquals(0, a[-0]);
|
| +
|
| /* Chromium bug: 424619
|
| * a[-Infinity] = 50;
|
| * assertEquals(undefined, a[-Infinity]);
|
| @@ -542,6 +567,13 @@ function TestTypedArraysWithIllegalIndicesStrict() {
|
| assertEquals(10, a["-1e2"]);
|
| assertEquals(undefined, a[-1e2]);
|
|
|
| + a["-0"] = 256;
|
| + var s2 = " -0";
|
| + a[s2] = 255;
|
| + assertEquals(undefined, a["-0"]);
|
| + assertEquals(255, a[s2]);
|
| + assertEquals(0, a[-0]);
|
| +
|
| /* Chromium bug: 424619
|
| * a[-Infinity] = 50;
|
| * assertEquals(undefined, a[-Infinity]);
|
| @@ -633,6 +665,19 @@ function TestDataViewPropertyTypeChecks() {
|
|
|
| TestDataViewPropertyTypeChecks();
|
|
|
| +
|
| +function TestDataViewToStringTag() {
|
| + var a = new DataView(new ArrayBuffer(10));
|
| + assertEquals("[object DataView]", Object.prototype.toString.call(a));
|
| + var desc = Object.getOwnPropertyDescriptor(
|
| + DataView.prototype, Symbol.toStringTag);
|
| + assertTrue(desc.configurable);
|
| + assertFalse(desc.enumerable);
|
| + assertFalse(desc.writable);
|
| + assertEquals("DataView", desc.value);
|
| +}
|
| +
|
| +
|
| // General tests for properties
|
|
|
| // Test property attribute [[Enumerable]]
|
|
|