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:
@ -82,4 +82,9 @@ public class DartTokenizerTest extends CpdTextComparisonTest {
|
||||
doTest("string_multiline");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTabWidth() {
|
||||
doTest("tabWidth");
|
||||
}
|
||||
|
||||
}
|
||||
|
3
pmd-dart/src/test/resources/net/sourceforge/pmd/cpd/testdata/tabWidth.dart
vendored
Normal file
3
pmd-dart/src/test/resources/net/sourceforge/pmd/cpd/testdata/tabWidth.dart
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
class MyClass {
|
||||
var s1 = 'test';
|
||||
}
|
13
pmd-dart/src/test/resources/net/sourceforge/pmd/cpd/testdata/tabWidth.txt
vendored
Normal file
13
pmd-dart/src/test/resources/net/sourceforge/pmd/cpd/testdata/tabWidth.txt
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
[Image] or [Truncated image[ Bcol Ecol
|
||||
L1
|
||||
[class] 1 5
|
||||
[MyClass] 7 13
|
||||
[{] 15 15
|
||||
L2
|
||||
[var] 2 4
|
||||
[s1] 6 7
|
||||
[=] 9 9
|
||||
['test'] 11 16
|
||||
L3
|
||||
[}] 1 1
|
||||
EOF
|
Reference in New Issue
Block a user