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

Commit

Permalink
add test case to reproduce #150, SQLDev parser bug
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippSalvisberg committed Oct 10, 2021
1 parent 0b6bf5f commit b351f68
Showing 1 changed file with 45 additions and 0 deletions.
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);
}
}

0 comments on commit b351f68

Please sign in to comment.