Skip to content

Commit

Permalink
Issue checkstyle#11446: Update TestTabViolation Method Of Checkertest
Browse files Browse the repository at this point in the history
  • Loading branch information
piyush-1234 committed Feb 12, 2024
1 parent 28e85b7 commit b98957c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
12 changes: 5 additions & 7 deletions src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1408,13 +1408,11 @@ public void testHaltOnExceptionOff() throws Exception {

@Test
public void testTabViolationDefault() throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(VerifyPositionAfterTabFileSet.class);
final String[] expected = {
"2:9: violation",
"3:17: violation",
"10:17: violation",
"13:33: violation",
};
verify(checkConfig, getPath("InputCheckerTabCharacter.txt"),
verifyWithInlineConfigParser(getPath("InputCheckerTabCharacter.txt"),
expected);
}

Expand All @@ -1425,8 +1423,8 @@ public void testTabViolation() throws Exception {
final DefaultConfiguration checkerConfig = createRootConfig(checkConfig);
checkerConfig.addProperty("tabWidth", "4");
final String[] expected = {
"2:5: violation",
"3:9: violation",
"10:13: violation",
"13:33: violation",
};
verify(checkerConfig, getPath("InputCheckerTabCharacter.txt"),
expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public final class TestInputConfiguration {
"com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck",
"com.puppycrawl.tools.checkstyle.checks.whitespace.FileTabCharacterCheck",
"com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheckTest$ViolationFileSetCheck",
"com.puppycrawl.tools.checkstyle.api.FileSetCheckTest$TestFileSetCheck"
"com.puppycrawl.tools.checkstyle.api.FileSetCheckTest$TestFileSetCheck",
"com.puppycrawl.tools.checkstyle.CheckerTest$VerifyPositionAfterTabFileSet"
));

private final List<ModuleInputConfiguration> childrenModules;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
//has no tabs
//has tab
//has 2 tabs
/*
com.puppycrawl.tools.checkstyle.CheckerTest$VerifyPositionAfterTabFileSet

*/

// has no tabs
line1

// has a tab
line4 // violation

// has 2 tabs
line5 // violation // violation

0 comments on commit b98957c

Please sign in to comment.