forked from phoedos/pmd
[cpp] Migrate tests to JUnit5
This commit is contained in:
@ -72,11 +72,6 @@
|
||||
<artifactId>hamcrest</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
|
@ -74,8 +74,8 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -4,17 +4,17 @@
|
||||
|
||||
package net.sourceforge.pmd.cpd;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest;
|
||||
|
||||
public class CPPTokenizerTest extends CpdTextComparisonTest {
|
||||
class CPPTokenizerTest extends CpdTextComparisonTest {
|
||||
|
||||
public CPPTokenizerTest() {
|
||||
CPPTokenizerTest() {
|
||||
super(".cpp");
|
||||
}
|
||||
|
||||
@ -36,106 +36,106 @@ public class CPPTokenizerTest extends CpdTextComparisonTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUTFwithBOM() {
|
||||
void testUTFwithBOM() {
|
||||
Tokenizer tokenizer = newTokenizer(dontSkipBlocks());
|
||||
Tokens tokens = tokenize(tokenizer, "\ufeffint start()\n{ int ret = 1;\nreturn ret;\n}\n");
|
||||
assertEquals(15, tokens.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContinuation() {
|
||||
void testContinuation() {
|
||||
doTest("continuation");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContinuationInIdent() {
|
||||
void testContinuationInIdent() {
|
||||
doTest("continuation_intra_token");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContinuationBetweenTokens() {
|
||||
void testContinuationBetweenTokens() {
|
||||
doTest("continuation_inter_token");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnicodeStringSupport() {
|
||||
void testUnicodeStringSupport() {
|
||||
doTest("unicodeStrings");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIgnoreBetweenSpecialComments() {
|
||||
void testIgnoreBetweenSpecialComments() {
|
||||
doTest("specialComments");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiLineMacros() {
|
||||
void testMultiLineMacros() {
|
||||
doTest("multilineMacros");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIdentifierValidChars() {
|
||||
void testIdentifierValidChars() {
|
||||
doTest("identifierChars");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWrongUnicodeInIdentifier() {
|
||||
void testWrongUnicodeInIdentifier() {
|
||||
expectTokenMgrError(" void main() { int ⚜ = __; }");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTokenizerWithSkipBlocks() {
|
||||
void testTokenizerWithSkipBlocks() {
|
||||
doTest("simpleSkipBlocks", "_skipDefault", skipBlocks());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTokenizerWithSkipBlocksPattern() {
|
||||
void testTokenizerWithSkipBlocksPattern() {
|
||||
doTest("simpleSkipBlocks", "_skipDebug", skipBlocks("#if debug|#endif"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTokenizerWithoutSkipBlocks() {
|
||||
void testTokenizerWithoutSkipBlocks() {
|
||||
doTest("simpleSkipBlocks", "_noSkip", dontSkipBlocks());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsm() {
|
||||
void testAsm() {
|
||||
// ASM code containing the '@' character
|
||||
doTest("asm", "", dontSkipBlocks());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPreprocessingDirectives() {
|
||||
void testPreprocessingDirectives() {
|
||||
doTest("preprocessorDirectives");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLiterals() {
|
||||
void testLiterals() {
|
||||
doTest("literals");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLexicalErrorFilename() {
|
||||
void testLexicalErrorFilename() {
|
||||
expectTokenMgrError(sourceText("issue-1559"), dontSkipBlocks());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRawStringLiterals() {
|
||||
void testRawStringLiterals() {
|
||||
doTest("issue-1784");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTabWidth() {
|
||||
void testTabWidth() {
|
||||
doTest("tabWidth");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLongListsOfNumbersAreNotIgnored() {
|
||||
void testLongListsOfNumbersAreNotIgnored() {
|
||||
doTest("listOfNumbers");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLongListsOfNumbersAreIgnored() {
|
||||
void testLongListsOfNumbersAreIgnored() {
|
||||
doTest("listOfNumbers", "_ignored", skipLiteralSequences());
|
||||
}
|
||||
|
||||
|
@ -4,29 +4,29 @@
|
||||
|
||||
package net.sourceforge.pmd.lang.cpp.ast;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class CppCharStreamTest {
|
||||
class CppCharStreamTest {
|
||||
|
||||
@Test
|
||||
public void testContinuationUnix() throws IOException {
|
||||
void testContinuationUnix() throws IOException {
|
||||
CppCharStream stream = CppCharStream.newCppCharStream(new StringReader("a\\\nb"));
|
||||
assertStream(stream, "ab");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContinuationWindows() throws IOException {
|
||||
void testContinuationWindows() throws IOException {
|
||||
CppCharStream stream = CppCharStream.newCppCharStream(new StringReader("a\\\r\nb"));
|
||||
assertStream(stream, "ab");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBackup() throws IOException {
|
||||
void testBackup() throws IOException {
|
||||
CppCharStream stream = CppCharStream.newCppCharStream(new StringReader("a\\b\\\rc"));
|
||||
assertStream(stream, "a\\b\\\rc");
|
||||
}
|
||||
|
Reference in New Issue
Block a user