diff --git a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/PlsqlTreeDumpTest.java b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/PlsqlTreeDumpTest.java new file mode 100644 index 0000000000..d04401d2f7 --- /dev/null +++ b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/PlsqlTreeDumpTest.java @@ -0,0 +1,29 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.plsql.ast; + +import org.junit.Test; + +import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper; +import net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest; +import net.sourceforge.pmd.lang.ast.test.RelevantAttributePrinter; +import net.sourceforge.pmd.lang.plsql.PlsqlParsingHelper; + +public class PlsqlTreeDumpTest extends BaseTreeDumpTest { + + public PlsqlTreeDumpTest() { + super(new RelevantAttributePrinter(), ".pls"); + } + + @Override + public BaseParsingHelper getParser() { + return PlsqlParsingHelper.WITH_PROCESSING.withResourceContext(getClass()); + } + + @Test + public void sqlPlusLexicalVariables() { + doTest("SqlPlusLexicalVariablesIssue195"); + } +} diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.pls b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.pls new file mode 100644 index 0000000000..9fa47759c3 --- /dev/null +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.pls @@ -0,0 +1,6 @@ + +-- see https://github.com/pmd/pmd/issues/195 +-- both define and spool are SQL*Plus commands, and they should not be ended with a semi-colon. + +define patch_name = acme_module +spool &patch_name..log diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.txt new file mode 100644 index 0000000000..d5ddc15d5a --- /dev/null +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.txt @@ -0,0 +1,9 @@ ++- Input[@CanonicalImage = null, @ExcludedLinesCount = 0, @ExcludedRangesCount = 0, @Sourcecode = " +-- see https://github.com/pmd/pmd/issues/195 +-- both define and spool are SQL*Plus commands, and they should not be ended with a semi-colon. + +define patch_name = acme_module +spool &patch_name..log +"] + +- SqlPlusCommand[@CanonicalImage = "DEFINE PATCH_NAME = ACME_MODULE", @Image = "define patch_name = acme_module "] + +- SqlPlusCommand[@CanonicalImage = "SPOOL &PATCH_NAME. . LOG", @Image = "spool &patch_name. . log "]