Add text comparison tests for CPD

This commit is contained in:
Clément Fournier
2020-05-19 15:41:29 +02:00
parent 5653400257
commit b47001c90d
9 changed files with 501 additions and 54 deletions

View File

@@ -54,5 +54,10 @@
<artifactId>pmd-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-lang-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,52 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest;
public class DartTokenizerTest2 extends CpdTextComparisonTest {
public DartTokenizerTest2() {
super(".dart");
}
@NotNull
@Override
protected String getResourcePrefix() {
return "";
}
@Test
public void testComment() {
doTest("comment");
}
@Test
public void testMultiline() {
doTest("string_multiline");
}
@Test
public void testStringWithBackslashes() {
doTest("string_with_backslashes");
}
@Test
public void testIncrement() {
doTest("increment");
}
@NotNull
@Override
public Tokenizer newTokenizer() {
return new DartTokenizer();
}
}

View File

@@ -0,0 +1,7 @@
[Image] or [Truncated image[ Bcol Ecol
L3
[var] 1 3
[x] 5 5
[=] 7 7
[0] 9 9
[EOF] -1 -1

View File

@@ -0,0 +1,207 @@
[Image] or [Truncated image[ Bcol Ecol
L3
[var] 1 3
[x] 5 5
[=] 7 7
[0] 9 9
L5
[void] 1 4
[increment1] 6 15
[(] 16 16
[)] 17 17
[{] 19 19
[x] 21 21
[+=] 23 24
[1] 26 26
[}] 29 29
L6
[void] 1 4
[increment2] 6 15
[(] 16 16
[)] 17 17
[{] 19 19
[x] 21 21
[+=] 23 24
[1] 26 26
[}] 29 29
L7
[void] 1 4
[increment3] 6 15
[(] 16 16
[)] 17 17
[{] 19 19
[x] 21 21
[+=] 23 24
[1] 26 26
[}] 29 29
L8
[void] 1 4
[increment4] 6 15
[(] 16 16
[)] 17 17
[{] 19 19
[x] 21 21
[+=] 23 24
[1] 26 26
[}] 29 29
L9
[void] 1 4
[increment5] 6 15
[(] 16 16
[)] 17 17
[{] 19 19
[x] 21 21
[+=] 23 24
[1] 26 26
[}] 29 29
L10
[void] 1 4
[increment6] 6 15
[(] 16 16
[)] 17 17
[{] 19 19
[x] 21 21
[+=] 23 24
[1] 26 26
[}] 29 29
L11
[void] 1 4
[increment7] 6 15
[(] 16 16
[)] 17 17
[{] 19 19
[x] 21 21
[+=] 23 24
[1] 26 26
[}] 29 29
L12
[void] 1 4
[increment8] 6 15
[(] 16 16
[)] 17 17
[{] 19 19
[x] 21 21
[+=] 23 24
[1] 26 26
[}] 29 29
L13
[void] 1 4
[increment9] 6 15
[(] 16 16
[)] 17 17
[{] 19 19
[x] 21 21
[+=] 23 24
[1] 26 26
[}] 29 29
L14
[void] 1 4
[increment10] 6 16
[(] 17 17
[)] 18 18
[{] 20 20
[x] 22 22
[+=] 24 25
[1] 27 27
[}] 30 30
L15
[void] 1 4
[increment11] 6 16
[(] 17 17
[)] 18 18
[{] 20 20
[x] 22 22
[+=] 24 25
[1] 27 27
[}] 30 30
L16
[void] 1 4
[increment12] 6 16
[(] 17 17
[)] 18 18
[{] 20 20
[x] 22 22
[+=] 24 25
[1] 27 27
[}] 30 30
L17
[void] 1 4
[increment13] 6 16
[(] 17 17
[)] 18 18
[{] 20 20
[x] 22 22
[+=] 24 25
[1] 27 27
[}] 30 30
L18
[void] 1 4
[increment14] 6 16
[(] 17 17
[)] 18 18
[{] 20 20
[x] 22 22
[+=] 24 25
[1] 27 27
[}] 30 30
L19
[void] 1 4
[increment15] 6 16
[(] 17 17
[)] 18 18
[{] 20 20
[x] 22 22
[+=] 24 25
[1] 27 27
[}] 30 30
L20
[void] 1 4
[increment16] 6 16
[(] 17 17
[)] 18 18
[{] 20 20
[x] 22 22
[+=] 24 25
[1] 27 27
[}] 30 30
L21
[void] 1 4
[increment17] 6 16
[(] 17 17
[)] 18 18
[{] 20 20
[x] 22 22
[+=] 24 25
[1] 27 27
[}] 30 30
L22
[void] 1 4
[increment18] 6 16
[(] 17 17
[)] 18 18
[{] 20 20
[x] 22 22
[+=] 24 25
[1] 27 27
[}] 30 30
L23
[void] 1 4
[increment19] 6 16
[(] 17 17
[)] 18 18
[{] 20 20
[x] 22 22
[+=] 24 25
[1] 27 27
[}] 30 30
L24
[void] 1 4
[increment20] 6 16
[(] 17 17
[)] 18 18
[{] 20 20
[x] 22 22
[+=] 24 25
[1] 27 27
[}] 30 30
[EOF] -1 -1

View File

@@ -0,0 +1,18 @@
[Image] or [Truncated image[ Bcol Ecol
L1
[class] 1 5
[MyClass] 7 13
[{] 15 15
L2
[var] 5 7
[s1] 9 10
[=] 12 12
['''\nYou can create\nmulti-line st[ 14 69
L7
[var] 5 7
[s2] 9 10
[=] 12 12
["""This is also a\nmulti-line stri[ 14 52
L9
[}] 1 1
[EOF] -1 -1

View File

@@ -0,0 +1,13 @@
[Image] or [Truncated image[ Bcol Ecol
L1
[class] 1 5
[MyClass] 7 13
[{] 15 15
L2
[final] 3 7
[stringWithBackslashes] 9 29
[=] 31 31
["Escaping\\ spaces\\ should work"] 33 63
L3
[}] 1 1
[EOF] -1 -1