From 1b80a159c5722dcfe6ee82058cb8ba266025c439 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath <2+defunkt@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:30:27 -0800 Subject: [PATCH] hwhitespace --- src/compiler/tests/function-blocks.test.ts | 12 ++++++------ src/parser/tests/functions.test.ts | 4 ++-- src/parser/tests/multiline.test.ts | 4 ++-- src/utils/tree.ts | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/compiler/tests/function-blocks.test.ts b/src/compiler/tests/function-blocks.test.ts index 41bf65d..4c91731 100644 --- a/src/compiler/tests/function-blocks.test.ts +++ b/src/compiler/tests/function-blocks.test.ts @@ -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]) }) }) diff --git a/src/parser/tests/functions.test.ts b/src/parser/tests/functions.test.ts index 092f153..d2d7f9f 100644 --- a/src/parser/tests/functions.test.ts +++ b/src/parser/tests/functions.test.ts @@ -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`) diff --git a/src/parser/tests/multiline.test.ts b/src/parser/tests/multiline.test.ts index 84e3815..9362181 100644 --- a/src/parser/tests/multiline.test.ts +++ b/src/parser/tests/multiline.test.ts @@ -76,12 +76,12 @@ end expect(` do: 2 - + end `).toMatchTree(` FunctionDef Do do - Params + Params colon : Number 2 keyword end diff --git a/src/utils/tree.ts b/src/utils/tree.ts index fa31562..c760082 100644 --- a/src/utils/tree.ts +++ b/src/utils/tree.ts @@ -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}` } }