diff options
Diffstat (limited to 'js/src/tests/non262/AsyncIterator/prototype/asIndexedPairs')
3 files changed, 66 insertions, 0 deletions
diff --git a/js/src/tests/non262/AsyncIterator/prototype/asIndexedPairs/asIndexedPairs.js b/js/src/tests/non262/AsyncIterator/prototype/asIndexedPairs/asIndexedPairs.js new file mode 100644 index 0000000000..71ae91d602 --- /dev/null +++ b/js/src/tests/non262/AsyncIterator/prototype/asIndexedPairs/asIndexedPairs.js @@ -0,0 +1,25 @@ +// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator')) + +async function* gen() { + yield 1; + yield 2; + yield 3; +} + +let iter = gen().asIndexedPairs(); + +for (const v of [[0, 1], [1, 2], [2, 3]]) { + iter.next().then( + result => { + console.log(result); + assertEq(result.done, false); + assertEq(result.value[0], v[0]); + assertEq(result.value[1], v[1]); + } + ); +} + +iter.next().then(({done}) => assertEq(done, true)); + +if (typeof reportCompare === 'function') + reportCompare(0, 0); diff --git a/js/src/tests/non262/AsyncIterator/prototype/asIndexedPairs/length.js b/js/src/tests/non262/AsyncIterator/prototype/asIndexedPairs/length.js new file mode 100644 index 0000000000..6854cd7dd2 --- /dev/null +++ b/js/src/tests/non262/AsyncIterator/prototype/asIndexedPairs/length.js @@ -0,0 +1,21 @@ +// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator')) +// + +/*--- +esid: pending +description: %AsyncIterator.prototype%.asIndexedPairs length value and descriptor. +info: > + 17 ECMAScript Standard Built-in Objects +features: [iterator-helpers] +---*/ + +assertEq(AsyncIterator.prototype.asIndexedPairs.length, 0); + +const propertyDescriptor = Reflect.getOwnPropertyDescriptor(AsyncIterator.prototype.asIndexedPairs, 'length'); +assertEq(propertyDescriptor.value, 0); +assertEq(propertyDescriptor.enumerable, false); +assertEq(propertyDescriptor.writable, false); +assertEq(propertyDescriptor.configurable, true); + +if (typeof reportCompare == 'function') + reportCompare(0, 0); diff --git a/js/src/tests/non262/AsyncIterator/prototype/asIndexedPairs/name.js b/js/src/tests/non262/AsyncIterator/prototype/asIndexedPairs/name.js new file mode 100644 index 0000000000..c19ac4105e --- /dev/null +++ b/js/src/tests/non262/AsyncIterator/prototype/asIndexedPairs/name.js @@ -0,0 +1,20 @@ +// |reftest| skip-if(!this.hasOwnProperty('AsyncIterator')) + +/*--- +esid: pending +description: %AsyncIterator.prototype%.asIndexedPairs.name value and descriptor. +info: > + 17 ECMAScript Standard Built-in Objects +features: [iterator-helpers] +---*/ + +assertEq(AsyncIterator.prototype.asIndexedPairs.name, 'asIndexedPairs'); + +const propertyDescriptor = Reflect.getOwnPropertyDescriptor(AsyncIterator.prototype.asIndexedPairs, 'name'); +assertEq(propertyDescriptor.value, 'asIndexedPairs'); +assertEq(propertyDescriptor.enumerable, false); +assertEq(propertyDescriptor.writable, false); +assertEq(propertyDescriptor.configurable, true); + +if (typeof reportCompare == 'function') + reportCompare(0, 0); |