throw null

This commit is contained in:
Dmitry Vasilev
2023-02-08 04:09:53 +08:00
parent 13e4e7feca
commit 653ecc7479
6 changed files with 48 additions and 19 deletions

View File

@@ -456,6 +456,21 @@ export const tests = [
)
}),
test('throw null', () => {
assert_code_error(`throw null`, null)
}),
test('throw null from function', () => {
const code = `
const throws = () => { throw null }
throws()
`
const s = test_initial_state(code)
const moved = COMMANDS.move_cursor(s, code.indexOf('throws()'))
assert_equal(moved.value_explorer.result.ok, false)
assert_equal(moved.value_explorer.result.error, null)
}),
test('new', () => {
assert_code_evals_to('new Error("test").message', 'test')
}),
@@ -2774,6 +2789,13 @@ const y = x()`
)
}),
test('async/await promise rejected with null', async () => {
await assert_code_error_async(
`await Promise.reject()`,
undefined
)
}),
test('async/await await rejected Promise returned from async', async () => {
await assert_code_error_async(
`