not iterable error

This commit is contained in:
Dmitry Vasilev
2023-07-06 18:34:03 +03:00
parent 65bfacc180
commit 2f577d955d
6 changed files with 91 additions and 22 deletions

View File

@@ -837,6 +837,23 @@ export const tests = [
)
}),
test('array spread not iterable', () => {
assert_code_error(
`[...null]`,
new Error('null is not iterable'),
)
}),
test('args spread not iterable', () => {
assert_code_error(
`
function x() {}
x(...null)
`,
new Error('null is not iterable'),
)
}),
test('module not found', () => {
const parsed = parse_modules(
'a',
@@ -2336,6 +2353,20 @@ const y = x()`
assert_equal(s2.value_explorer.result.error.message, 'boom')
}),
test('move_cursor error in fn args bug', () => {
const code = `
function x() {}
x(null.foo)
`
const i = test_initial_state(code)
const m = COMMANDS.move_cursor(i, code.indexOf('x(null'))
assert_equal(
m.value_explorer.result.error,
new Error("Cannot read properties of null (reading 'foo')")
)
}),
test('frame follows cursor toplevel', () => {
const code = `
const x = () => {