This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test case to reproduce #150, SQLDev parser bug
- Loading branch information
1 parent
0b6bf5f
commit b351f68
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
tests/src/test/java/com/trivadis/plsql/formatter/settings/tests/issues/Issue_150_define.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.trivadis.plsql.formatter.settings.tests.issues; | ||
|
||
import com.trivadis.plsql.formatter.settings.ConfiguredTestFormatter; | ||
import oracle.dbtools.app.Format; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
|
||
public class Issue_150_define extends ConfiguredTestFormatter { | ||
|
||
@BeforeEach | ||
public void setup_non_trivadis_default_settings() { | ||
getFormatter().options.put(getFormatter().idCase, Format.Case.lower); | ||
} | ||
|
||
@Test | ||
@Disabled("SQLDev 21.2.1 bug") | ||
public void set_define_after_at_command() throws IOException { | ||
// in SQLDev 21.2.1 SET is part of the @ command | ||
// As a result DEFINE becomes a command, and it starts on a new line | ||
// Same behavior with START as with @. | ||
var sql = """ | ||
define table_folder = 'table' | ||
set define on | ||
@./demo/&&table_folder/drop_demo_tables.sql | ||
set define off | ||
"""; | ||
formatAndAssert(sql); | ||
} | ||
|
||
@Test | ||
public void commit_after_at_command() throws IOException { | ||
// workaround | ||
var sql = """ | ||
define table_folder = 'table' | ||
set define on | ||
@./demo/&&table_folder/drop_demo_tables.sql | ||
commit; -- workaround | ||
set define off | ||
"""; | ||
formatAndAssert(sql); | ||
} | ||
} |