mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 01:29:17 +00:00
LibJS/Tests: Add a test for an async function which returns a thenable
This test passes when running in the AST interpreter, but fails when running for bytecode.
This commit is contained in:
parent
eb1f61f3b1
commit
016b31fae2
Notes:
sideshowbarker
2024-07-17 11:34:34 +09:00
Author: https://github.com/shannonbooth
Commit: 016b31fae2
Pull-request: https://github.com/SerenityOS/serenity/pull/20069
Reviewed-by: https://github.com/linusg
1 changed files with 12 additions and 0 deletions
|
@ -200,3 +200,15 @@ describe("await cannot be used in class static init blocks", () => {
|
||||||
expect("class A{ static { async function* await() {} } }").not.toEval();
|
expect("class A{ static { async function* await() {} } }").not.toEval();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("async returning a thenable", () => {
|
||||||
|
let isCalled = false;
|
||||||
|
const f = async () => ({
|
||||||
|
then() {
|
||||||
|
isCalled = true;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
f();
|
||||||
|
runQueuedPromiseJobs();
|
||||||
|
expect(isCalled).toBe(true);
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue