This commit is contained in:
Dmitry Vasilev
2022-12-16 13:15:27 +08:00
parent 2cbb546b8c
commit 416fdcf20b
2 changed files with 50 additions and 37 deletions

View File

@@ -2612,6 +2612,15 @@ const y = x()`
)
}),
test('async/await await Promise resolved immediately', async () => {
await assert_code_evals_to_async(
`
await new Promise(resolve => resolve(1))
`,
1
)
}),
test('async/await return from async function', async () => {
await assert_code_evals_to_async(
`
@@ -2746,6 +2755,20 @@ const y = x()`
assert_equal(logs, [1, 2])
}),
/* TODO
test('p', async () => {
const i = await assert_code_evals_to_async(`
const res = Promise.resolve(1)
Object.assign(res, {mark: 'resolved'})
await Object.assign(new Promise(resolve => resolve()), {mark: 'w'})
`,
1
)
}),
*/
test('async/await logs out of order', async () => {
const i = await test_initial_state_async(`
// Init promises p1 and p2 that are resolved in different order (p2 then