Skip to content

Commit

Permalink
Don't crash when encountering goto labels in T-SQL
Browse files Browse the repository at this point in the history
Fixes #632
  • Loading branch information
nene committed Sep 1, 2023
1 parent 54dd4f3 commit ab75ffc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/languages/transactsql/transactsql.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ export const transactsql: DialectOptions = {
'&=',
'^=',
'::',
':',
],
// TODO: Support for money constants
},
Expand Down
15 changes: 15 additions & 0 deletions test/transactsql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,19 @@ describe('TransactSqlFormatter', () => {
tbl
`);
});

it('formats goto labels', () => {
const result = format(
`InfiniLoop:
SELECT 'Hello.';
GOTO InfiniLoop;`
);
expect(result).toBe(dedent`
InfiniLoop:
SELECT
'Hello.';
GOTO InfiniLoop;
`);
});
});

0 comments on commit ab75ffc

Please sign in to comment.