fix let without assignment

This commit is contained in:
Dmitry Vasilev
2023-10-30 15:13:29 +08:00
parent 376799de84
commit 84ed01dbf2
2 changed files with 16 additions and 1 deletions

View File

@@ -329,6 +329,16 @@ export const tests = [
assert_equal(i.value_explorer.result.value, {y: 2, z: 3, q: 4})
}),
test('let variable not initialized bug', () => {
const code = `
let x
x /*label*/
`
const i = test_initial_state(code, code.indexOf('x /*label'))
assert_equal(i.value_explorer.result.ok, true)
assert_equal(i.value_explorer.result.value === undefined, true)
}),
test('else if', () => {
const code = `
let x