Skip to content

Commit

Permalink
Issue #12251: Resolve Pitest suppression for AbstractParenPadCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin authored and nrmancuso committed Oct 6, 2022
1 parent 70bbcd8 commit ba8efc2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
9 changes: 0 additions & 9 deletions .ci/pitest-suppressions/pitest-whitespace-suppressions.xml
Expand Up @@ -9,15 +9,6 @@
<lineContent>option = PadOption.valueOf(optionStr.trim().toUpperCase(Locale.ENGLISH));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>AbstractParenPadCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPadCheck</mutatedClass>
<mutatedMethod>setOption</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator</mutator>
<description>replaced call to java/lang/String::trim with receiver</description>
<lineContent>option = PadOption.valueOf(optionStr.trim().toUpperCase(Locale.ENGLISH));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>EmptyForInitializerPadCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForInitializerPadCheck</mutatedClass>
Expand Down
Expand Up @@ -146,6 +146,14 @@ public void test1322879() throws Exception {
expected);
}

@Test
public void testTrimOptionProperty() throws Exception {
final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
verifyWithInlineConfigParser(
getPath("InputParenPadToCheckTrimFunctionInOptionProperty.java"),
expected);
}

@Test
public void testNospaceWithComplexInput() throws Exception {
final String[] expected = {
Expand Down
@@ -0,0 +1,33 @@
/*
ParenPad
option = \tSPACE
tokens = (default)ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, DOT, \
ENUM_CONSTANT_DEF, EXPR, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, \
LITERAL_NEW, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL, \
METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA, RECORD_DEF
*/

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

public class InputParenPadToCheckTrimFunctionInOptionProperty {

public InputParenPadToCheckTrimFunctionInOptionProperty ( int i ) // ok
{
this ();
toString ();
}
protected InputParenPadToCheckTrimFunctionInOptionProperty ()
{
super ();
}

public void enhancedFor ()
{
int[] i = new int[2];
for ( int j: i ) { // ok
System.identityHashCode ( j );
}
}
}

0 comments on commit ba8efc2

Please sign in to comment.