mirror of https://github.com/tc39/test262.git
Add `next` method test
This commit is contained in:
parent
ae8694b4b7
commit
1bf4e159dd
|
@ -0,0 +1,38 @@
|
||||||
|
// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-%asyncfromsynciteratorprototype%.next
|
||||||
|
description: >
|
||||||
|
`next` method does not pass absent `value`.
|
||||||
|
info: |
|
||||||
|
%AsyncFromSyncIteratorPrototype%.next ( value )
|
||||||
|
|
||||||
|
[...]
|
||||||
|
5. If value is present, then
|
||||||
|
[...]
|
||||||
|
6. Else,
|
||||||
|
a. Let result be IteratorNext(syncIteratorRecord).
|
||||||
|
[...]
|
||||||
|
flags: [async]
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var nextArgumentsLength;
|
||||||
|
var syncIterator = {
|
||||||
|
[Symbol.iterator]() {
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
next() {
|
||||||
|
nextArgumentsLength = arguments.length;
|
||||||
|
return {done: true};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
var asyncIterator = (async function* () {
|
||||||
|
yield* syncIterator;
|
||||||
|
})();
|
||||||
|
|
||||||
|
asyncIterator.next().then(function() {
|
||||||
|
assert.sameValue(nextArgumentsLength, 0);
|
||||||
|
}).then($DONE, $DONE);
|
Loading…
Reference in New Issue