Fixup incorrect assertion in AsyncGenerator.p.return with broken promises

This commit is contained in:
Chengzhong Wu 2025-05-13 10:36:26 +01:00 committed by Philip Chimento
parent bd472562c8
commit 9b127c190c

View File

@ -46,17 +46,21 @@ Object.defineProperty(brokenPromise, 'constructor', {
}
});
it.next();
it.return(brokenPromise)
.then(
() => {
throw new Test262Error("Expected rejection");
},
err => {
assert(unblocked, false, 'return should be rejected before generator is resumed');
assert.sameValue(err.message, 'broken promise');
}
)
.then($DONE, $DONE);
it.next().then(function(result) {
assert.sameValue(result.value, undefined);
assert.sameValue(result.done, true);
it.return(brokenPromise)
.then(
() => {
throw new Test262Error("Expected rejection");
},
err => {
assert(unblocked, 'return should be rejected when the generator is completed');
assert.sameValue(err.message, 'broken promise');
}
)
.then($DONE, $DONE);
});
unblock();