Skip to content

Commit 7483d64

Browse files
authored
Add test for adjacent string literals preservation
I added a unit test to assert the specific case you reported. Added test in modules/database-commons/src/test/java/org/testcontainers/ext/ScriptSplittingTest.java: testAdjacentStringLiteralsSeparatedByNewlineArePreserved checks that: - CREATE TABLE collapses newlines to spaces. - COMMENT ON COLUMN ... IS 'First sentence. '\n'Second sentence' preserves the required newline between quoted strings.
1 parent 3cc0fc7 commit 7483d64

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

modules/database-commons/src/test/java/org/testcontainers/ext/ScriptSplittingTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ void testStringDemarcation() {
2121
splitAndCompare(script, expected);
2222
}
2323

24+
@Test
25+
void testAdjacentStringLiteralsSeparatedByNewlineArePreserved() {
26+
String script =
27+
"CREATE TABLE test (\n" +
28+
" x int\n" +
29+
");\n" +
30+
"\n" +
31+
"COMMENT ON COLUMN test.x\n" +
32+
" IS 'First sentence. '\n" +
33+
" 'Second sentence';";
34+
35+
List<String> expected = Arrays.asList(
36+
"CREATE TABLE test ( x int )",
37+
"COMMENT ON COLUMN test.x IS 'First sentence. '\n'Second sentence'"
38+
);
39+
40+
splitAndCompare(script, expected);
41+
}
42+
2443
@Test
2544
void testIssue1547Case1() {
2645
String script =

0 commit comments

Comments
 (0)