From 3fbb030287f1e6a7ffbb73d2ae3b5e7fd963cb5e Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Wed, 1 Nov 2023 10:53:30 +0200 Subject: [PATCH] Keep Postgres-specific E'' string tests out of shared string tests --- test/features/strings.ts | 27 --------------------------- test/postgresql.test.ts | 3 ++- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/test/features/strings.ts b/test/features/strings.ts index 2bd6471067..ee27c489aa 100644 --- a/test/features/strings.ts +++ b/test/features/strings.ts @@ -12,7 +12,6 @@ type StringType = | "''-bs" // with backslash escaping | "U&''" // with repeated-quote escaping | "N''" // with escaping style depending on whether also ''-qq or ''-bs was specified - | "E''" // with escaping style depending on whether also ''-qq or ''-bs was specified | "X''" // no escaping | 'X""' // no escaping | "B''" // no escaping @@ -140,32 +139,6 @@ export default function supportsStrings(format: FormatFn, stringTypes: StringTyp }); } - if (stringTypes.includes("E''")) { - it('supports unicode strings', () => { - expect(format("SELECT E'where' FROM E'update'")).toBe(dedent` - SELECT - E'where' - FROM - E'update' - `); - }); - - if (stringTypes.includes("''-qq")) { - it("supports escaping in E'' strings with repeated quote", () => { - expect(format("E'foo '' JOIN bar'")).toBe("E'foo '' JOIN bar'"); - }); - } - if (stringTypes.includes("''-bs")) { - it("supports escaping in E'' strings with a backslash", () => { - expect(format("E'foo \\' JOIN bar'")).toBe("E'foo \\' JOIN bar'"); - }); - } - - it("detects consecutive E'' strings as separate ones", () => { - expect(format("E'foo'E'bar'")).toBe("E'foo' E'bar'"); - }); - } - if (stringTypes.includes("X''")) { it('supports hex byte sequences', () => { expect(format("x'0E'")).toBe("x'0E'"); diff --git a/test/postgresql.test.ts b/test/postgresql.test.ts index 3022121128..cdb0deb934 100644 --- a/test/postgresql.test.ts +++ b/test/postgresql.test.ts @@ -52,7 +52,7 @@ describe('PostgreSqlFormatter', () => { supportsOnConflict(format); supportsUpdate(format, { whereCurrentOf: true }); supportsTruncateTable(format, { withoutTable: true }); - supportsStrings(format, ["''-qq", "U&''", "X''", "B''", "E''"]); + supportsStrings(format, ["''-qq", "U&''", "X''", "B''"]); supportsIdentifiers(format, [`""-qq`, 'U&""']); supportsBetween(format); supportsSchema(format); @@ -167,6 +167,7 @@ describe('PostgreSqlFormatter', () => { FROM foo `); + expect(format("E'blah''blah'")).toBe("E'blah''blah'"); }); it('supports dollar-quoted strings', () => {