mirror of https://github.com/tc39/test262.git
Fix bug in test
This test's description concerns the behavior of `Promise.all` when the IteratorStep abstract operation fails due to an abrupt completion returned by the iterator's `next` method. The test body did not actually assert that functionality. Update the test body to correctly define the requisite iterator and assert that the specific error created is the one thrown from the invocation of `Promise.all`
This commit is contained in:
parent
12cc01484e
commit
6f2feb0157
|
@ -11,20 +11,17 @@ description: iterator.next throws, causing Promise.all to reject
|
|||
---*/
|
||||
|
||||
var iterThrows = {};
|
||||
Object.defineProperty(iterThrows, Symbol.iterator, {
|
||||
get: function () {
|
||||
return {
|
||||
next: function () {
|
||||
throw new Error("abrupt completion");
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
var error = new Test262Error();
|
||||
iterThrows[Symbol.iterator] = function() {
|
||||
return {
|
||||
next: function () {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Promise.all(iterThrows).then(function () {
|
||||
$ERROR('Promise unexpectedly resolved: Promise.all(iterThrows) should throw TypeError');
|
||||
},function (err) {
|
||||
if (!(err instanceof TypeError)) {
|
||||
$ERROR('Expected TypeError, got ' + err);
|
||||
}
|
||||
},function (reason) {
|
||||
assert.sameValue(reason, error);
|
||||
}).then($DONE,$DONE);
|
||||
|
|
Loading…
Reference in New Issue