[lang-test] Move classes into n.s.p.lang.test

This commit is contained in:
Andreas Dangel
2024-02-23 12:04:54 +01:00
parent 45d2a6935e
commit 3a7460de29
189 changed files with 301 additions and 303 deletions

View File

@ -119,7 +119,7 @@ against a previously recorded version. If there are differences, the test fails.
This helps to detect anything in the AST structure that changed, maybe unexpectedly. This helps to detect anything in the AST structure that changed, maybe unexpectedly.
* Create a test class in the package `net.sourceforge.pmd.lang.$lang.ast` with the name `$langTreeDumpTest`. * Create a test class in the package `net.sourceforge.pmd.lang.$lang.ast` with the name `$langTreeDumpTest`.
* This test class must extend `net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest`. Note: This class * This test class must extend `net.sourceforge.pmd.lang.test.ast.BaseTreeDumpTest`. Note: This class
is written in kotlin and is available in the module "lang-test". is written in kotlin and is available in the module "lang-test".
* Add a default constructor, that calls the super constructor like so: * Add a default constructor, that calls the super constructor like so:
@ -131,7 +131,7 @@ This helps to detect anything in the AST structure that changed, maybe unexpecte
Replace "$lang" and "$extension" accordingly. Replace "$lang" and "$extension" accordingly.
* Implement the method `getParser()`. It must return a * Implement the method `getParser()`. It must return a
subclass of `net.sourceforge.pmd.lang.ast.test.BaseParsingHelper`. See subclass of `net.sourceforge.pmd.lang.test.ast.BaseParsingHelper`. See
`net.sourceforge.pmd.lang.ecmascript.ast.JsParsingHelper` for an example. `net.sourceforge.pmd.lang.ecmascript.ast.JsParsingHelper` for an example.
With this parser helper you can also specify, where the test files are searched, by using With this parser helper you can also specify, where the test files are searched, by using
the method `withResourceContext(Class<?>, String)`. the method `withResourceContext(Class<?>, String)`.

View File

@ -332,6 +332,12 @@ in the migration guide for details.
* {%jdoc core::lang.rule.xpath.XPathRule %} has been moved into subpackage {% jdoc_package core::lang.rule.xpath %}. * {%jdoc core::lang.rule.xpath.XPathRule %} has been moved into subpackage {% jdoc_package core::lang.rule.xpath %}.
* pmd-html * pmd-html
* `net.sourceforge.pmd.lang.html.ast.HtmlCpdLexer` moved into package `cpd`: {%jdoc html::lang.html.cpd.HtmlCpdLexer %}. * `net.sourceforge.pmd.lang.html.ast.HtmlCpdLexer` moved into package `cpd`: {%jdoc html::lang.html.cpd.HtmlCpdLexer %}.
* pmd-lang-test: All types have been moved under the new base package {%jdoc_package lang-test::lang.test %}:
* {%jdoc lang-test::lang.test.AbstractMetricTestRule %} (moved from `net.sourceforge.pmd.test.AbstractMetricTestRule`)
* {%jdoc lang-test::lang.test.BaseTextComparisonTest %} (moved from `net.sourceforge.pmd.test.BaseTextComparisonTest`)
* {%jdoc lang-test::lang.test.cpd.CpdTextComparisonTest %} (moved from `net.sourceforge.pmd.cpd.test.CpdTextComparisonTest`)
* {%jdoc lang-test::lang.test.ast.BaseTreeDumpTest %} (moved from `net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest`)
* Any many other types have been moved from `net.sourceforge.pmd.lang.ast.test` to `net.sourceforge.pmd.lang.test`.
**Internalized classes and interfaces and methods** **Internalized classes and interfaces and methods**

View File

@ -4,8 +4,8 @@
package net.sourceforge.pmd.lang.apex; package net.sourceforge.pmd.lang.apex;
import static net.sourceforge.pmd.lang.ast.test.TestUtilsKt.assertSize; import static net.sourceforge.pmd.lang.test.ast.TestUtilsKt.assertSize;
import static net.sourceforge.pmd.lang.ast.test.TestUtilsKt.assertSuppressed; import static net.sourceforge.pmd.lang.test.ast.TestUtilsKt.assertSuppressed;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.List; import java.util.List;

View File

@ -4,8 +4,8 @@
package net.sourceforge.pmd.lang.apex.ast; package net.sourceforge.pmd.lang.apex.ast;
import static net.sourceforge.pmd.lang.ast.test.NodeExtensionsKt.textOfReportLocation; import static net.sourceforge.pmd.lang.test.ast.NodeExtensionsKt.textOfReportLocation;
import static net.sourceforge.pmd.lang.ast.test.TestUtilsKt.assertPosition; import static net.sourceforge.pmd.lang.test.ast.TestUtilsKt.assertPosition;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.hamcrest.core.StringContains.containsString; import static org.hamcrest.core.StringContains.containsString;

View File

@ -5,7 +5,7 @@
package net.sourceforge.pmd.lang.apex.ast; package net.sourceforge.pmd.lang.apex.ast;
import net.sourceforge.pmd.lang.apex.ApexLanguageModule; import net.sourceforge.pmd.lang.apex.ApexLanguageModule;
import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper; import net.sourceforge.pmd.lang.test.ast.BaseParsingHelper;
public class ApexParsingHelper extends BaseParsingHelper<ApexParsingHelper, ASTApexFile> { public class ApexParsingHelper extends BaseParsingHelper<ApexParsingHelper, ASTApexFile> {

View File

@ -7,9 +7,9 @@ package net.sourceforge.pmd.lang.apex.ast;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper; import net.sourceforge.pmd.lang.test.ast.BaseParsingHelper;
import net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest; import net.sourceforge.pmd.lang.test.ast.BaseTreeDumpTest;
import net.sourceforge.pmd.lang.ast.test.RelevantAttributePrinter; import net.sourceforge.pmd.lang.test.ast.RelevantAttributePrinter;
class ApexTreeDumpTest extends BaseTreeDumpTest { class ApexTreeDumpTest extends BaseTreeDumpTest {

View File

@ -6,7 +6,7 @@ package net.sourceforge.pmd.lang.apex.cpd;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; import net.sourceforge.pmd.lang.test.cpd.CpdTextComparisonTest;
import net.sourceforge.pmd.lang.apex.ApexLanguageModule; import net.sourceforge.pmd.lang.apex.ApexLanguageModule;
class ApexCpdLexerTest extends CpdTextComparisonTest { class ApexCpdLexerTest extends CpdTextComparisonTest {

View File

@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.apex.metrics.impl;
import net.sourceforge.pmd.lang.apex.ast.ASTMethod; import net.sourceforge.pmd.lang.apex.ast.ASTMethod;
import net.sourceforge.pmd.lang.apex.metrics.ApexMetrics; import net.sourceforge.pmd.lang.apex.metrics.ApexMetrics;
import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.test.AbstractMetricTestRule; import net.sourceforge.pmd.lang.test.AbstractMetricTestRule;
/** /**
* @author Gwilym Kuiper * @author Gwilym Kuiper

View File

@ -8,7 +8,7 @@ import net.sourceforge.pmd.lang.apex.ast.ASTMethod;
import net.sourceforge.pmd.lang.apex.ast.ASTUserClassOrInterface; import net.sourceforge.pmd.lang.apex.ast.ASTUserClassOrInterface;
import net.sourceforge.pmd.lang.apex.metrics.ApexMetrics; import net.sourceforge.pmd.lang.apex.metrics.ApexMetrics;
import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.test.AbstractMetricTestRule; import net.sourceforge.pmd.lang.test.AbstractMetricTestRule;
/** /**
* Tests standard cyclo. * Tests standard cyclo.

View File

@ -6,7 +6,7 @@ package net.sourceforge.pmd.lang.apex.metrics.impl;
import net.sourceforge.pmd.lang.apex.metrics.ApexMetrics; import net.sourceforge.pmd.lang.apex.metrics.ApexMetrics;
import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.test.AbstractMetricTestRule; import net.sourceforge.pmd.lang.test.AbstractMetricTestRule;
/** /**
* @author Clément Fournier * @author Clément Fournier

View File

@ -12,7 +12,7 @@ import net.sourceforge.pmd.lang.apex.ast.ASTUserEnum;
import net.sourceforge.pmd.lang.apex.ast.ASTUserInterface; import net.sourceforge.pmd.lang.apex.ast.ASTUserInterface;
import net.sourceforge.pmd.lang.apex.ast.ASTUserTrigger; import net.sourceforge.pmd.lang.apex.ast.ASTUserTrigger;
import net.sourceforge.pmd.lang.apex.ast.ApexParserTestBase; import net.sourceforge.pmd.lang.apex.ast.ApexParserTestBase;
import net.sourceforge.pmd.lang.ast.test.TestUtilsKt; import net.sourceforge.pmd.lang.test.ast.TestUtilsKt;
import net.sourceforge.pmd.reporting.Report; import net.sourceforge.pmd.reporting.Report;
class AbstractApexRuleTest extends ApexParserTestBase { class AbstractApexRuleTest extends ApexParserTestBase {

View File

@ -4,7 +4,7 @@
package net.sourceforge.pmd.lang.apex.rule; package net.sourceforge.pmd.lang.apex.rule;
import static net.sourceforge.pmd.lang.ast.test.TestUtilsKt.assertSize; import static net.sourceforge.pmd.lang.test.ast.TestUtilsKt.assertSize;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -6,7 +6,7 @@ package net.sourceforge.pmd.lang.coco.cpd;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; import net.sourceforge.pmd.lang.test.cpd.CpdTextComparisonTest;
import net.sourceforge.pmd.lang.coco.CocoLanguageModule; import net.sourceforge.pmd.lang.coco.CocoLanguageModule;
class CocoCpdLexerTest extends CpdTextComparisonTest { class CocoCpdLexerTest extends CpdTextComparisonTest {

View File

@ -12,8 +12,8 @@ import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.cpd.CpdLanguageProperties; import net.sourceforge.pmd.cpd.CpdLanguageProperties;
import net.sourceforge.pmd.cpd.CpdLexer; import net.sourceforge.pmd.cpd.CpdLexer;
import net.sourceforge.pmd.cpd.Tokens; import net.sourceforge.pmd.cpd.Tokens;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; import net.sourceforge.pmd.lang.test.cpd.CpdTextComparisonTest;
import net.sourceforge.pmd.cpd.test.LanguagePropertyConfig; import net.sourceforge.pmd.lang.test.cpd.LanguagePropertyConfig;
import net.sourceforge.pmd.lang.cpp.CppLanguageModule; import net.sourceforge.pmd.lang.cpp.CppLanguageModule;
class CppCpdLexerTest extends CpdTextComparisonTest { class CppCpdLexerTest extends CpdTextComparisonTest {

View File

@ -10,8 +10,8 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.cpd.CpdLanguageProperties; import net.sourceforge.pmd.cpd.CpdLanguageProperties;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; import net.sourceforge.pmd.lang.test.cpd.CpdTextComparisonTest;
import net.sourceforge.pmd.cpd.test.LanguagePropertyConfig; import net.sourceforge.pmd.lang.test.cpd.LanguagePropertyConfig;
import net.sourceforge.pmd.lang.ast.LexException; import net.sourceforge.pmd.lang.ast.LexException;
class CsCpdLexerTest extends CpdTextComparisonTest { class CsCpdLexerTest extends CpdTextComparisonTest {

View File

@ -6,7 +6,7 @@ package net.sourceforge.pmd.lang.dart.cpd;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; import net.sourceforge.pmd.lang.test.cpd.CpdTextComparisonTest;
class DartCpdLexerTest extends CpdTextComparisonTest { class DartCpdLexerTest extends CpdTextComparisonTest {

View File

@ -6,7 +6,7 @@ package net.sourceforge.pmd.lang.fortran.cpd;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; import net.sourceforge.pmd.lang.test.cpd.CpdTextComparisonTest;
/** /**
* @author rpelisse * @author rpelisse

View File

@ -6,7 +6,7 @@ package net.sourceforge.pmd.lang.gherkin.cpd;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; import net.sourceforge.pmd.lang.test.cpd.CpdTextComparisonTest;
class GherkinCpdLexerTest extends CpdTextComparisonTest { class GherkinCpdLexerTest extends CpdTextComparisonTest {
GherkinCpdLexerTest() { GherkinCpdLexerTest() {

View File

@ -6,7 +6,7 @@ package net.sourceforge.pmd.lang.go.cpd;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; import net.sourceforge.pmd.lang.test.cpd.CpdTextComparisonTest;
class GoCpdLexerTest extends CpdTextComparisonTest { class GoCpdLexerTest extends CpdTextComparisonTest {

View File

@ -6,7 +6,7 @@ package net.sourceforge.pmd.lang.groovy.cpd;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; import net.sourceforge.pmd.lang.test.cpd.CpdTextComparisonTest;
class GroovyCpdLexerTest extends CpdTextComparisonTest { class GroovyCpdLexerTest extends CpdTextComparisonTest {

View File

@ -4,7 +4,7 @@
package net.sourceforge.pmd.lang.html.ast; package net.sourceforge.pmd.lang.html.ast;
import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper; import net.sourceforge.pmd.lang.test.ast.BaseParsingHelper;
import net.sourceforge.pmd.lang.html.HtmlLanguageModule; import net.sourceforge.pmd.lang.html.HtmlLanguageModule;
public final class HtmlParsingHelper extends BaseParsingHelper<HtmlParsingHelper, ASTHtmlDocument> { public final class HtmlParsingHelper extends BaseParsingHelper<HtmlParsingHelper, ASTHtmlDocument> {

View File

@ -7,9 +7,9 @@ package net.sourceforge.pmd.lang.html.ast;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper; import net.sourceforge.pmd.lang.test.ast.BaseParsingHelper;
import net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest; import net.sourceforge.pmd.lang.test.ast.BaseTreeDumpTest;
import net.sourceforge.pmd.lang.ast.test.RelevantAttributePrinter; import net.sourceforge.pmd.lang.test.ast.RelevantAttributePrinter;
class HtmlTreeDumpTest extends BaseTreeDumpTest { class HtmlTreeDumpTest extends BaseTreeDumpTest {
HtmlTreeDumpTest() { HtmlTreeDumpTest() {

View File

@ -6,9 +6,9 @@ package net.sourceforge.pmd.lang.html.ast;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper; import net.sourceforge.pmd.lang.test.ast.BaseParsingHelper;
import net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest; import net.sourceforge.pmd.lang.test.ast.BaseTreeDumpTest;
import net.sourceforge.pmd.lang.ast.test.CoordinatesPrinter; import net.sourceforge.pmd.lang.test.ast.CoordinatesPrinter;
class PositionTest extends BaseTreeDumpTest { class PositionTest extends BaseTreeDumpTest {
PositionTest() { PositionTest() {

View File

@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.html.cpd;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; import net.sourceforge.pmd.lang.test.cpd.CpdTextComparisonTest;
import net.sourceforge.pmd.lang.html.HtmlLanguageModule; import net.sourceforge.pmd.lang.html.HtmlLanguageModule;
class HtmlCpdLexerTest extends CpdTextComparisonTest { class HtmlCpdLexerTest extends CpdTextComparisonTest {

View File

@ -4,8 +4,8 @@
package net.sourceforge.pmd; package net.sourceforge.pmd;
import static net.sourceforge.pmd.lang.ast.test.TestUtilsKt.assertSize; import static net.sourceforge.pmd.lang.test.ast.TestUtilsKt.assertSize;
import static net.sourceforge.pmd.lang.ast.test.TestUtilsKt.assertSuppressed; import static net.sourceforge.pmd.lang.test.ast.TestUtilsKt.assertSuppressed;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -4,8 +4,8 @@
package net.sourceforge.pmd; package net.sourceforge.pmd;
import static net.sourceforge.pmd.lang.ast.test.TestUtilsKt.assertSize; import static net.sourceforge.pmd.lang.test.ast.TestUtilsKt.assertSize;
import static net.sourceforge.pmd.lang.ast.test.TestUtilsKt.assertSuppressed; import static net.sourceforge.pmd.lang.test.ast.TestUtilsKt.assertSuppressed;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import java.util.Optional; import java.util.Optional;

View File

@ -4,7 +4,7 @@
package net.sourceforge.pmd.lang.java; package net.sourceforge.pmd.lang.java;
import net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest; import net.sourceforge.pmd.lang.test.ast.BaseTreeDumpTest;
/** /**
* Special tweak of BaseTreeDumpTest to remove deprecated attributes * Special tweak of BaseTreeDumpTest to remove deprecated attributes

View File

@ -11,7 +11,7 @@ import java.util.stream.Collectors;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.test.RelevantAttributePrinter; import net.sourceforge.pmd.lang.test.ast.RelevantAttributePrinter;
import net.sourceforge.pmd.lang.java.ast.ASTExpression; import net.sourceforge.pmd.lang.java.ast.ASTExpression;
import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTModifierList; import net.sourceforge.pmd.lang.java.ast.ASTModifierList;

View File

@ -24,7 +24,7 @@ import net.sourceforge.pmd.lang.LanguageProcessor;
import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.SemanticErrorReporter; import net.sourceforge.pmd.lang.ast.SemanticErrorReporter;
import net.sourceforge.pmd.lang.ast.SemanticException; import net.sourceforge.pmd.lang.ast.SemanticException;
import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper; import net.sourceforge.pmd.lang.test.ast.BaseParsingHelper;
import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit; import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit;
import net.sourceforge.pmd.lang.java.ast.JavaParser; import net.sourceforge.pmd.lang.java.ast.JavaParser;
import net.sourceforge.pmd.lang.java.internal.JavaAstProcessor; import net.sourceforge.pmd.lang.java.internal.JavaAstProcessor;

View File

@ -4,7 +4,7 @@
package net.sourceforge.pmd.lang.java; package net.sourceforge.pmd.lang.java;
import static net.sourceforge.pmd.lang.ast.test.TestUtilsKt.assertSize; import static net.sourceforge.pmd.lang.test.ast.TestUtilsKt.assertSize;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

Some files were not shown because too many files have changed in this diff Show More