hwhitespace
This commit is contained in:
parent
e38e8d4f1e
commit
3eac0a27a5
|
|
@ -23,15 +23,15 @@ describe('multi line function blocks', () => {
|
|||
test('work with no args', () => {
|
||||
expect(`
|
||||
trap = do x: x end
|
||||
trap:
|
||||
true
|
||||
trap:
|
||||
true
|
||||
end`).toEvaluateTo(true)
|
||||
})
|
||||
|
||||
test('work with one arg', () => {
|
||||
expect(`
|
||||
trap = do x y: [ x (y) ] end
|
||||
trap EXIT:
|
||||
trap EXIT:
|
||||
true
|
||||
end`).toEvaluateTo(['EXIT', true])
|
||||
})
|
||||
|
|
@ -39,7 +39,7 @@ end`).toEvaluateTo(['EXIT', true])
|
|||
test('work with named args', () => {
|
||||
expect(`
|
||||
attach = do signal fn: [ signal (fn) ] end
|
||||
attach signal='exit':
|
||||
attach signal='exit':
|
||||
true
|
||||
end`).toEvaluateTo(['exit', true])
|
||||
})
|
||||
|
|
@ -48,8 +48,8 @@ end`).toEvaluateTo(['exit', true])
|
|||
test('work with dot-get', () => {
|
||||
expect(`
|
||||
signals = [trap=do x y: [x (y)] end]
|
||||
signals.trap 'EXIT':
|
||||
true
|
||||
signals.trap 'EXIT':
|
||||
true
|
||||
end`).toEvaluateTo(['EXIT', true])
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ describe('calling functions', () => {
|
|||
Identifier tail
|
||||
NamedArg
|
||||
NamedArgPrefix lines=
|
||||
⚠
|
||||
⚠
|
||||
⚠ `)
|
||||
})
|
||||
})
|
||||
|
|
@ -73,7 +73,7 @@ describe('Do', () => {
|
|||
expect('do: 1 end').toMatchTree(`
|
||||
FunctionDef
|
||||
Do do
|
||||
Params
|
||||
Params
|
||||
colon :
|
||||
Number 1
|
||||
keyword end`)
|
||||
|
|
|
|||
|
|
@ -76,12 +76,12 @@ end
|
|||
expect(`
|
||||
do:
|
||||
2
|
||||
|
||||
|
||||
end
|
||||
`).toMatchTree(`
|
||||
FunctionDef
|
||||
Do do
|
||||
Params
|
||||
Params
|
||||
colon :
|
||||
Number 2
|
||||
keyword end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ const nodeToString = (node: SyntaxNode, input: string, depth = 0): string => {
|
|||
} else {
|
||||
// Only strip quotes from whole String nodes (legacy DoubleQuote), not StringFragment/EscapeSeq/CurlyString
|
||||
const cleanText = nodeName === 'String' ? text.slice(1, -1) : text
|
||||
return `${indent}${nodeName} ${cleanText}`
|
||||
return cleanText ? `${indent}${nodeName} ${cleanText}` : `${indent}${nodeName}`
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user