fix coloring

This commit is contained in:
Dmitry Vasilev
2023-10-13 19:14:43 +03:00
parent 794b9c70c9
commit 8cd34535a8
2 changed files with 69 additions and 1 deletions

View File

@@ -1662,6 +1662,30 @@ const y = x()`
assert_equal(color_body.result.ok, true)
}),
test('coloring error with nested fns', () => {
const code = `[1].map(_ => {throw new Error()}).map(x => x + 1)`
const i = test_initial_state(code)
const coloring = color_file(i, '')
const result = {ok: false, error_origin: true}
assert_equal(
coloring,
[
{
index: 0,
length: code.indexOf('_ =>'),
result
},
{
index: code.indexOf(').map(x =>'),
length: 1,
result
},
]
)
}),
test('better parse errors', () => {
const code = `
const x = z => {