Skip to content

Commit 6fb6753

Browse files
quote operator tests
1 parent b6909f9 commit 6fb6753

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/test/kotlin/com/github/vertical_blank/sqlformatter/PlSqlFormatterTest.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ object PlSqlFormatterTest :
2828
supportsStrings(
2929
formatter,
3030
listOf(
31-
StringLiteral.DOUBLE_QUOTE, StringLiteral.SINGLE_QUOTE, StringLiteral.BACK_QUOTE))
31+
StringLiteral.DOUBLE_QUOTE,
32+
StringLiteral.SINGLE_QUOTE,
33+
StringLiteral.BACK_QUOTE,
34+
StringLiteral.Q_SINGLE_QUOTE))
3235
supportsBetween(formatter)
3336
supportsSchema(formatter)
3437
supportsOperators(formatter, listOf("||", "**", "!=", ":="))

src/test/kotlin/com/github/vertical_blank/sqlformatter/features/Strings.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,18 @@ fun Suite.supportsStrings(formatter: SqlFormatter.Formatter, stringTypes: List<S
6565
expect(format("N'foo \\' JOIN bar'")).toBe("N'foo \\' JOIN bar'")
6666
}
6767
}
68+
69+
if (stringTypes.contains(StringLiteral.Q_SINGLE_QUOTE)) {
70+
it("supports Oracle quotation operator") {
71+
expect(format("Q'[I'm boy]'")).toBe("Q'[I'm boy]'")
72+
expect(format("Q'{I'm boy}'")).toBe("Q'{I'm boy}'")
73+
expect(format("Q'<I'm boy>'")).toBe("Q'<I'm boy>'")
74+
expect(format("Q'(I'm boy)'")).toBe("Q'(I'm boy)'")
75+
expect(format("NQ'[I'm boy]'")).toBe("NQ'[I'm boy]'")
76+
expect(format("NQ'{I'm boy}'")).toBe("NQ'{I'm boy}'")
77+
expect(format("NQ'<I'm boy>'")).toBe("NQ'<I'm boy>'")
78+
expect(format("NQ'(I'm boy)'")).toBe("NQ'(I'm boy)'")
79+
}
80+
}
6881
}
6982
}

0 commit comments

Comments
 (0)