mirror of https://github.com/tc39/test262.git
Fix async iterator methods not passing absent values tests (#2571)
* Fix `next` method test * Fix `return` method test * Drop `throw` method test %AsyncFromSyncIteratorPrototype%.throw is always called with `value`.
This commit is contained in:
parent
13d057dffc
commit
156d1b68fd
|
@ -29,10 +29,8 @@ var syncIterator = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var asyncIterator = (async function* () {
|
(async function () {
|
||||||
yield* syncIterator;
|
for await (let _ of syncIterator);
|
||||||
})();
|
|
||||||
|
|
||||||
asyncIterator.next().then(function() {
|
|
||||||
assert.sameValue(nextArgumentsLength, 0);
|
assert.sameValue(nextArgumentsLength, 0);
|
||||||
}).then($DONE, $DONE);
|
})().then($DONE, $DONE);
|
||||||
|
|
|
@ -32,12 +32,10 @@ var syncIterator = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var asyncIterator = (async function* () {
|
(async function () {
|
||||||
yield* syncIterator;
|
for await (let _ of syncIterator) {
|
||||||
})();
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
asyncIterator.next().then(function() {
|
|
||||||
return asyncIterator.return();
|
|
||||||
}).then(function() {
|
|
||||||
assert.sameValue(returnArgumentsLength, 0);
|
assert.sameValue(returnArgumentsLength, 0);
|
||||||
}).then($DONE, $DONE);
|
})().then($DONE, $DONE);
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
/*---
|
|
||||||
esid: sec-%asyncfromsynciteratorprototype%.throw
|
|
||||||
description: >
|
|
||||||
`throw` method does not pass absent `value`.
|
|
||||||
info: |
|
|
||||||
%AsyncFromSyncIteratorPrototype%.throw ( value )
|
|
||||||
|
|
||||||
[...]
|
|
||||||
8. If value is present, then
|
|
||||||
[...]
|
|
||||||
9. Else,
|
|
||||||
a. Let result be Call(throw, syncIterator).
|
|
||||||
[...]
|
|
||||||
flags: [async]
|
|
||||||
features: [async-iteration]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
var throwArgumentsLength;
|
|
||||||
var syncIterator = {
|
|
||||||
[Symbol.iterator]() {
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
next() {
|
|
||||||
return {done: false};
|
|
||||||
},
|
|
||||||
throw() {
|
|
||||||
throwArgumentsLength = arguments.length;
|
|
||||||
return {done: true};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
var asyncIterator = (async function* () {
|
|
||||||
yield* syncIterator;
|
|
||||||
})();
|
|
||||||
|
|
||||||
asyncIterator.next().then(function() {
|
|
||||||
return asyncIterator.throw();
|
|
||||||
}).then(function(result) {
|
|
||||||
throw new Test262Error("Promise should be rejected, got: " + result.value);
|
|
||||||
}, function() {
|
|
||||||
assert.sameValue(throwArgumentsLength, 0);
|
|
||||||
}).then($DONE, $DONE);
|
|
Loading…
Reference in New Issue