| Index: test/mjsunit/harmony/array-iterator.js
|
| diff --git a/test/mjsunit/harmony/array-iterator.js b/test/mjsunit/harmony/array-iterator.js
|
| index 6a402e739394a67e8fdba3ad15d35dc55a628721..cbe3b142c476b7ab506b490b73cbdfcd8e06b108 100644
|
| --- a/test/mjsunit/harmony/array-iterator.js
|
| +++ b/test/mjsunit/harmony/array-iterator.js
|
| @@ -27,6 +27,7 @@
|
|
|
| // Flags: --harmony-iteration --allow-natives-syntax
|
|
|
| +
|
| function TestArrayPrototype() {
|
| assertTrue(Array.prototype.hasOwnProperty('entries'));
|
| assertTrue(Array.prototype.hasOwnProperty('values'));
|
| @@ -38,10 +39,12 @@ function TestArrayPrototype() {
|
| }
|
| TestArrayPrototype();
|
|
|
| +
|
| function assertIteratorResult(value, done, result) {
|
| assertEquals({value: value, done: done}, result);
|
| }
|
|
|
| +
|
| function TestValues() {
|
| var array = ['a', 'b', 'c'];
|
| var iterator = array.values();
|
| @@ -55,6 +58,7 @@ function TestValues() {
|
| }
|
| TestValues();
|
|
|
| +
|
| function TestValuesMutate() {
|
| var array = ['a', 'b', 'c'];
|
| var iterator = array.values();
|
| @@ -67,6 +71,7 @@ function TestValuesMutate() {
|
| }
|
| TestValuesMutate();
|
|
|
| +
|
| function TestKeys() {
|
| var array = ['a', 'b', 'c'];
|
| var iterator = array.keys();
|
| @@ -80,6 +85,7 @@ function TestKeys() {
|
| }
|
| TestKeys();
|
|
|
| +
|
| function TestKeysMutate() {
|
| var array = ['a', 'b', 'c'];
|
| var iterator = array.keys();
|
| @@ -92,6 +98,7 @@ function TestKeysMutate() {
|
| }
|
| TestKeysMutate();
|
|
|
| +
|
| function TestEntries() {
|
| var array = ['a', 'b', 'c'];
|
| var iterator = array.entries();
|
| @@ -105,6 +112,7 @@ function TestEntries() {
|
| }
|
| TestEntries();
|
|
|
| +
|
| function TestEntriesMutate() {
|
| var array = ['a', 'b', 'c'];
|
| var iterator = array.entries();
|
| @@ -117,29 +125,40 @@ function TestEntriesMutate() {
|
| }
|
| TestEntriesMutate();
|
|
|
| +
|
| +function TestArrayIteratorPrototype() {
|
| + var ArrayIteratorPrototype = [].values().__proto__;
|
| + assertFalse(ArrayIteratorPrototype.hasOwnProperty('constructor'));
|
| + assertEquals(ArrayIteratorPrototype.__proto__, Object.prototype);
|
| + assertArrayEquals(['next'],
|
| + Object.getOwnPropertyNames(ArrayIteratorPrototype));
|
| +}
|
| +TestArrayIteratorPrototype();
|
| +
|
| +
|
| function TestArrayIteratorPrototype() {
|
| var array = [];
|
| var iterator = array.values();
|
|
|
| - var ArrayIterator = iterator.constructor;
|
| - assertEquals(ArrayIterator.prototype, array.values().__proto__);
|
| - assertEquals(ArrayIterator.prototype, array.keys().__proto__);
|
| - assertEquals(ArrayIterator.prototype, array.entries().__proto__);
|
| + var ArrayIteratorPrototype = iterator.__proto__;
|
|
|
| - assertEquals(Object.prototype, ArrayIterator.prototype.__proto__);
|
| + assertEquals(ArrayIteratorPrototype, array.values().__proto__);
|
| + assertEquals(ArrayIteratorPrototype, array.keys().__proto__);
|
| + assertEquals(ArrayIteratorPrototype, array.entries().__proto__);
|
| +
|
| + assertEquals(Object.prototype, ArrayIteratorPrototype.__proto__);
|
|
|
| assertEquals('Array Iterator', %_ClassOf(array.values()));
|
| assertEquals('Array Iterator', %_ClassOf(array.keys()));
|
| assertEquals('Array Iterator', %_ClassOf(array.entries()));
|
|
|
| - var prototypeDescriptor =
|
| - Object.getOwnPropertyDescriptor(ArrayIterator, 'prototype');
|
| - assertFalse(prototypeDescriptor.configurable);
|
| - assertFalse(prototypeDescriptor.enumerable);
|
| - assertFalse(prototypeDescriptor.writable);
|
| + assertFalse(ArrayIteratorPrototype.hasOwnProperty('constructor'));
|
| + assertArrayEquals(['next'],
|
| + Object.getOwnPropertyNames(ArrayIteratorPrototype));
|
| }
|
| TestArrayIteratorPrototype();
|
|
|
| +
|
| function TestForArrayValues() {
|
| var buffer = [];
|
| var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
|
| @@ -157,6 +176,7 @@ function TestForArrayValues() {
|
| }
|
| TestForArrayValues();
|
|
|
| +
|
| function TestForArrayKeys() {
|
| var buffer = [];
|
| var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
|
| @@ -173,6 +193,7 @@ function TestForArrayKeys() {
|
| }
|
| TestForArrayKeys();
|
|
|
| +
|
| function TestForArrayEntries() {
|
| var buffer = [];
|
| var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
|
|
|