Skip to content

Commit

Permalink
Issue #12430: Resolve Pitest suppression for SeparatorWrapCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
arinmodi committed Nov 21, 2022
1 parent ffa03c7 commit ebc6569
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
9 changes: 0 additions & 9 deletions .ci/pitest-suppressions/pitest-whitespace-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,6 @@
<lineContent>processLeft(ast.findFirstToken(TokenTypes.LPAREN));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>SeparatorWrapCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck</mutatedClass>
<mutatedMethod>visitToken</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to com/puppycrawl/tools/checkstyle/utils/CodePointUtil::trim with argument</description>
<lineContent>final int[] substringAfterToken = CodePointUtil.trim(</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>SingleSpaceSeparatorCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.SingleSpaceSeparatorCheck</mutatedClass>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,14 @@ public void testTrimOptionProperty() throws Exception {
verifyWithInlineConfigParser(
getPath("InputSeparatorWrapSetOptionTrim.java"), expected);
}

@Test
public void testCommaOnNewLine() throws Exception {
final String[] expected = {
"15:10: " + getCheckMessage(MSG_LINE_NEW, ","),
"19:26: " + getCheckMessage(MSG_LINE_NEW, ","),
};
verifyWithInlineConfigParser(
getPath("InputSeparatorWrapForTestComma2.java"), expected);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
SeparatorWrap
tokens = COMMA
option = nl
*/

package com.puppycrawl.tools.checkstyle.checks.whitespace.separatorwrap;

public class InputSeparatorWrapForTestComma2 {

String s;

// violation below '',' should be on a new line.'
int a,
b;

// violation below '',' should be on a new line.'
public void foo(int a,
int b) {
int r
, t; // OK
}

public void bar(int p
, int q) { // OK
}
}

0 comments on commit ebc6569

Please sign in to comment.