[plsql] Add test for #195 - SqlPlus lexical variables

This commit is contained in:
Andreas Dangel
2021-03-25 16:09:15 +01:00
parent 2eb2ce863f
commit f77608899f
3 changed files with 44 additions and 0 deletions

View File

@ -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");
}
}

View File

@ -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

View File

@ -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 "]