Skip to content

Commit 4ff8d1d

Browse files
authored
Keep semicolons after END when semicolon is not the separator (#8108)
1 parent 36c8727 commit 4ff8d1d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

modules/database-commons/src/main/java/org/testcontainers/ext/ScriptSplitter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ private boolean endOfBlock(boolean recursive) {
101101
if (";".equals(scanner.getCurrentMatch())) {
102102
if (recursive) {
103103
sb.append(temporary);
104-
appendMatch();
105104
}
105+
appendMatch();
106106
return true;
107107
}
108108
sb.append(temporary);

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,19 @@ public void testIfLoopBlocksSpecificSeparator() {
320320
" IF something_wrong THEN LEAVE rec_loop; END IF;\n" +
321321
" do_something_else;\n" +
322322
" END LOOP;\n" +
323-
"END",
323+
"END;",
324324
"CALL something();"
325325
);
326326
splitAndCompare(script, expected, "@");
327327
}
328328

329+
@Test
330+
public void oracleStyleBlocks() {
331+
String script = "BEGIN END; /\n" + "BEGIN END;";
332+
List<String> expected = Arrays.asList("BEGIN END;", "BEGIN END;");
333+
splitAndCompare(script, expected, "/");
334+
}
335+
329336
@Test
330337
public void testMultiProcedureMySQLScript() {
331338
String script =

0 commit comments

Comments
 (0)