Ensure CPD uses tab width of 1 for tabs consistently
The columns that are reported by CPD were inconsistent across languages before. A language like Java (using a JavaCC-based tokenizer) would use a width of 8 for tabs, whereas a language like C# (using an Antlr-based tokenizer) would use 1 instead. This includes unit tests for most languages to ensure a tab character is counted as 1. The configuration for JavaCC has been adjusted to respect this as well.
This commit is contained in:
@ -124,6 +124,11 @@ public class CPPTokenizerTest extends CpdTextComparisonTest {
|
||||
doTest("issue-1784");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTabWidth() {
|
||||
doTest("tabWidth");
|
||||
}
|
||||
|
||||
|
||||
private static Properties skipBlocks(String skipPattern) {
|
||||
return properties(true, skipPattern);
|
||||
|
1
pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/tabWidth.cpp
vendored
Normal file
1
pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/tabWidth.cpp
vendored
Normal file
@ -0,0 +1 @@
|
||||
int i = 0;
|
8
pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/tabWidth.txt
vendored
Normal file
8
pmd-cpp/src/test/resources/net/sourceforge/pmd/lang/cpp/cpd/testdata/tabWidth.txt
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
[Image] or [Truncated image[ Bcol Ecol
|
||||
L1
|
||||
[int] 2 4
|
||||
[i] 6 6
|
||||
[=] 8 8
|
||||
[0] 10 10
|
||||
[;] 11 11
|
||||
EOF
|
Reference in New Issue
Block a user