mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
throw null
This commit is contained in:
22
test/test.js
22
test/test.js
@@ -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(
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user