Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit b351f68

Browse files
add test case to reproduce #150, SQLDev parser bug
1 parent 0b6bf5f commit b351f68

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.trivadis.plsql.formatter.settings.tests.issues;
2+
3+
import com.trivadis.plsql.formatter.settings.ConfiguredTestFormatter;
4+
import oracle.dbtools.app.Format;
5+
import org.junit.jupiter.api.BeforeEach;
6+
import org.junit.jupiter.api.Disabled;
7+
import org.junit.jupiter.api.Test;
8+
9+
import java.io.IOException;
10+
11+
public class Issue_150_define extends ConfiguredTestFormatter {
12+
13+
@BeforeEach
14+
public void setup_non_trivadis_default_settings() {
15+
getFormatter().options.put(getFormatter().idCase, Format.Case.lower);
16+
}
17+
18+
@Test
19+
@Disabled("SQLDev 21.2.1 bug")
20+
public void set_define_after_at_command() throws IOException {
21+
// in SQLDev 21.2.1 SET is part of the @ command
22+
// As a result DEFINE becomes a command, and it starts on a new line
23+
// Same behavior with START as with @.
24+
var sql = """
25+
define table_folder = 'table'
26+
set define on
27+
@./demo/&&table_folder/drop_demo_tables.sql
28+
set define off
29+
""";
30+
formatAndAssert(sql);
31+
}
32+
33+
@Test
34+
public void commit_after_at_command() throws IOException {
35+
// workaround
36+
var sql = """
37+
define table_folder = 'table'
38+
set define on
39+
@./demo/&&table_folder/drop_demo_tables.sql
40+
commit; -- workaround
41+
set define off
42+
""";
43+
formatAndAssert(sql);
44+
}
45+
}

0 commit comments

Comments
 (0)