mirror of
https://github.com/tc39/test262.git
synced 2025-07-25 06:55:06 +02:00
Add and rename Array.fromAsync thenable rejection test cases
This commit is contained in:
parent
afc3d1bce4
commit
7cc98501d3
@ -0,0 +1,34 @@
|
||||
// Copyright (C) 2025 J. S. Choi. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.fromasync
|
||||
description: >
|
||||
Array.fromAsync closes any sync-iterable input with a rejecting thenable.
|
||||
includes: [asyncHelpers.js]
|
||||
flags: [async]
|
||||
features: [Array.fromAsync]
|
||||
---*/
|
||||
|
||||
asyncTest(async function () {
|
||||
const expectedValue = {};
|
||||
let finallyCounter = 0;
|
||||
const inputThenable = {
|
||||
then(resolve, reject) {
|
||||
reject();
|
||||
},
|
||||
};
|
||||
function* createInput() {
|
||||
try {
|
||||
yield inputThenable;
|
||||
} finally {
|
||||
finallyCounter++;
|
||||
}
|
||||
}
|
||||
const input = createInput();
|
||||
try {
|
||||
await Array.fromAsync(input);
|
||||
} finally {
|
||||
assert.sameValue(finallyCounter, 1);
|
||||
}
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user