async/await deferred calls test

This commit is contained in:
Dmitry Vasilev
2023-01-15 10:12:18 +08:00
parent 9a4bfe2593
commit 32e85f6d24

View File

@@ -2913,6 +2913,27 @@ const y = x()`
assert_equal(after_move.active_calltree_node.fn.name, 'f') assert_equal(after_move.active_calltree_node.fn.name, 'f')
}), }),
test('async/await move_cursor deferred call', async () => {
const code = `
export const fn = async () => {
await fn2()
}
const fn2 = async () => {
return 1
}
`
const {state: i, on_deferred_call} = test_deferred_calls_state(code)
// Make deferred call
i.modules[''].fn()
const state = on_deferred_call(i)
const moved_state = (await COMMANDS.move_cursor(state, code.indexOf('1')))
.state
assert_equal(moved_state.active_calltree_node.fn.name, 'fn2')
}),
test('async/await await argument bug', async () => { test('async/await await argument bug', async () => {
await assert_code_evals_to_async( await assert_code_evals_to_async(
` `