Skip to content

Commit 88c58b8

Browse files
committed
Add test for E'quoted' strings
1 parent c3816f1 commit 88c58b8

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

test/ddl/function.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,25 @@ describe("function", () => {
280280
`);
281281
});
282282

283+
it(`does not reformat E'quoted' strings`, async () => {
284+
expect(
285+
await pretty(
286+
dedent`
287+
CREATE FUNCTION my_func()
288+
RETURNS INT
289+
LANGUAGE sql
290+
AS E'SELECT 1'
291+
`,
292+
{ dialect: "postgresql" },
293+
),
294+
).toBe(dedent`
295+
CREATE FUNCTION my_func()
296+
RETURNS INT
297+
LANGUAGE sql
298+
AS E'SELECT 1'
299+
`);
300+
});
301+
283302
it(`handles SQL language identifier case-insensitively`, async () => {
284303
expect(
285304
await pretty(

test/ddl/procedure.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,23 @@ describe("procedure", () => {
161161
`);
162162
});
163163

164+
it(`does not reformat E'quoted' strings`, async () => {
165+
expect(
166+
await pretty(
167+
dedent`
168+
CREATE PROCEDURE foo()
169+
LANGUAGE sql
170+
AS E'SELECT 1'
171+
`,
172+
{ dialect: "postgresql" },
173+
),
174+
).toBe(dedent`
175+
CREATE PROCEDURE foo()
176+
LANGUAGE sql
177+
AS E'SELECT 1'
178+
`);
179+
});
180+
164181
it(`handles SQL language identifier case-insensitively`, async () => {
165182
expect(
166183
await pretty(

0 commit comments

Comments
 (0)