refactor children -> __children

This commit is contained in:
Dmitry Vasilev
2022-12-08 09:42:42 +08:00
parent 3ea0bedc31
commit de2d030aa9
2 changed files with 65 additions and 2 deletions

View File

@@ -2589,6 +2589,15 @@ const y = x()`
assert_equal(get_deferred_calls(result), null)
}),
test('async/await await non promise', async () => {
await assert_code_evals_to_async(
`
await 1
`,
1
)
}),
test('async/await return from async function', async () => {
await assert_code_evals_to_async(
`
@@ -2688,4 +2697,38 @@ const y = x()`
)
}),
//test('async/await calltree', async () => {
// const i = await test_initial_state_async(`
// const x = () => 1
// const delay = async time => {
// await 1 //Promise.resolve()
// x()
// }
// await delay(3)
// /* TODO
// await Promise.all([
// delay(3),
// ])
// */
// `)
// log(pp_calltree(root_calltree_node(i)))
// assert_equal(root_calltree_node(i).children.length, 1)
//}),
test('async/await logs out of order', async () => {
const i = await test_initial_state_async(`
const delay = async time => {
await new Promise(res => globalThis.setTimeout(res, time*10))
console.log(time)
}
await Promise.all([
delay(3),
delay(2),
delay(1),
])
`)
const logs = i.logs.logs.map(l => l.args[0])
assert_equal(logs, [1,2,3])
})
]