Skip to content

Commit ab75ffc

Browse files
committed
Don't crash when encountering goto labels in T-SQL
Fixes #632
1 parent 54dd4f3 commit ab75ffc

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/languages/transactsql/transactsql.formatter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ export const transactsql: DialectOptions = {
252252
'&=',
253253
'^=',
254254
'::',
255+
':',
255256
],
256257
// TODO: Support for money constants
257258
},

test/transactsql.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,19 @@ describe('TransactSqlFormatter', () => {
138138
tbl
139139
`);
140140
});
141+
142+
it('formats goto labels', () => {
143+
const result = format(
144+
`InfiniLoop:
145+
SELECT 'Hello.';
146+
GOTO InfiniLoop;`
147+
);
148+
expect(result).toBe(dedent`
149+
InfiniLoop:
150+
SELECT
151+
'Hello.';
152+
153+
GOTO InfiniLoop;
154+
`);
155+
});
141156
});

0 commit comments

Comments
 (0)