[swift] Migrate tests to JUnit5

This commit is contained in:
Andreas Dangel 2022-10-03 09:42:47 +02:00
parent b260cd011b
commit 2d459d9813
No known key found for this signature in database
GPG Key ID: 93450DF2DF9A3FA3
8 changed files with 23 additions and 29 deletions

View File

@ -70,8 +70,8 @@
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -6,13 +6,13 @@ package net.sourceforge.pmd.cpd;
import java.util.Properties;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest;
public class SwiftTokenizerTest extends CpdTextComparisonTest {
class SwiftTokenizerTest extends CpdTextComparisonTest {
public SwiftTokenizerTest() {
SwiftTokenizerTest() {
super(".swift");
}
@ -28,32 +28,32 @@ public class SwiftTokenizerTest extends CpdTextComparisonTest {
@Test
public void testSwift42() {
void testSwift42() {
doTest("Swift4.2");
}
@Test
public void testSwift50() {
void testSwift50() {
doTest("Swift5.0");
}
@Test
public void testSwift51() {
void testSwift51() {
doTest("Swift5.1");
}
@Test
public void testSwift52() {
void testSwift52() {
doTest("Swift5.2");
}
@Test
public void testStackoverflowOnLongLiteral() {
void testStackoverflowOnLongLiteral() {
doTest("Issue628");
}
@Test
public void testTabWidth() {
void testTabWidth() {
doTest("tabWidth");
}
}

View File

@ -4,20 +4,17 @@
package net.sourceforge.pmd.lang.swift.ast;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
*
*/
public class SwiftParserTests extends BaseSwiftTreeDumpTest {
class SwiftParserTests extends BaseSwiftTreeDumpTest {
@Test
public void testSimpleSwift() {
void testSimpleSwift() {
doTest("Simple");
}
@Test
public void testBtree() {
void testBtree() {
doTest("BTree");
}

View File

@ -4,27 +4,24 @@
package net.sourceforge.pmd.lang.swift.ast;
import org.jetbrains.annotations.NotNull;
import org.checkerframework.checker.nullness.qual.NonNull;
import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper;
import net.sourceforge.pmd.lang.swift.SwiftLanguageModule;
import net.sourceforge.pmd.lang.swift.ast.SwiftParser.SwTopLevel;
/**
*
*/
public class SwiftParsingHelper extends BaseParsingHelper<SwiftParsingHelper, SwTopLevel> {
public static final SwiftParsingHelper DEFAULT = new SwiftParsingHelper(Params.getDefault());
public SwiftParsingHelper(@NotNull Params params) {
public SwiftParsingHelper(@NonNull Params params) {
super(SwiftLanguageModule.NAME, SwTopLevel.class, params);
}
@NotNull
@NonNull
@Override
protected SwiftParsingHelper clone(@NotNull Params params) {
protected SwiftParsingHelper clone(@NonNull Params params) {
return new SwiftParsingHelper(params);
}
}

View File

@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.swift.rule.bestpractices;
import net.sourceforge.pmd.testframework.PmdRuleTst;
public class ProhibitedInterfaceBuilderTest extends PmdRuleTst {
class ProhibitedInterfaceBuilderTest extends PmdRuleTst {
// no additional unit tests
}

View File

@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.swift.rule.bestpractices;
import net.sourceforge.pmd.testframework.PmdRuleTst;
public class UnavailableFunctionTest extends PmdRuleTst {
class UnavailableFunctionTest extends PmdRuleTst {
// no additional unit tests
}

View File

@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.swift.rule.errorprone;
import net.sourceforge.pmd.testframework.PmdRuleTst;
public class ForceCastTest extends PmdRuleTst {
class ForceCastTest extends PmdRuleTst {
// no additional unit tests
}

View File

@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.swift.rule.errorprone;
import net.sourceforge.pmd.testframework.PmdRuleTst;
public class ForceTryTest extends PmdRuleTst {
class ForceTryTest extends PmdRuleTst {
// no additional unit tests
}