forked from phoedos/pmd
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:
@@ -34,4 +34,9 @@ public class LuaTokenizerTest extends CpdTextComparisonTest {
|
||||
public void testFactorial() {
|
||||
doTest("factorial");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTabWidth() {
|
||||
doTest("tabWidth");
|
||||
}
|
||||
}
|
||||
|
||||
2
pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/tabWidth.lua
vendored
Normal file
2
pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/tabWidth.lua
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
print("Hello World")
|
||||
|
||||
7
pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/tabWidth.txt
vendored
Normal file
7
pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/tabWidth.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
[Image] or [Truncated image[ Bcol Ecol
|
||||
L1
|
||||
[print] 2 6
|
||||
[(] 7 7
|
||||
["Hello World"] 8 20
|
||||
[)] 21 21
|
||||
EOF
|
||||
Reference in New Issue
Block a user