mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
bare return statements
This commit is contained in:
22
test/test.js
22
test/test.js
@@ -487,14 +487,13 @@ export const tests = [
|
||||
)
|
||||
}),
|
||||
|
||||
test('ASI_restrited', () => {
|
||||
// Currently we forbid bare return statement, TODO
|
||||
test('ASI_restricted', () => {
|
||||
assert_equal(
|
||||
do_parse(`
|
||||
return
|
||||
1
|
||||
`).ok,
|
||||
false
|
||||
true
|
||||
)
|
||||
assert_equal(
|
||||
do_parse(`
|
||||
@@ -945,6 +944,23 @@ export const tests = [
|
||||
assert_equal(x.result.version_number, 0)
|
||||
}),
|
||||
|
||||
test('bare return statement', () => {
|
||||
const code = `
|
||||
function test() {
|
||||
return
|
||||
}
|
||||
test() /*call*/
|
||||
`
|
||||
assert_value_explorer(
|
||||
test_initial_state(code, code.indexOf('test() /*call*/')),
|
||||
undefined,
|
||||
)
|
||||
assert_value_explorer(
|
||||
test_initial_state(code, code.indexOf('return')),
|
||||
undefined,
|
||||
)
|
||||
}),
|
||||
|
||||
test('array spread not iterable', () => {
|
||||
assert_code_error(
|
||||
`[...null]`,
|
||||
|
||||
Reference in New Issue
Block a user