Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #12261: Resolve Pitest suppression for EmptyForIteratorPadCheck #12263

Merged
merged 1 commit into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 0 additions & 18 deletions .ci/pitest-suppressions/pitest-whitespace-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,6 @@
<lineContent>final DetailAST semi = ast.getNextSibling();</lineContent>
</mutation>

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

<mutation unstable="false">
<sourceFile>EmptyForIteratorPadCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck</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>EmptyLineSeparatorCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck</mutatedClass>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,25 @@ public void testInvalidOption() throws Exception {
}
}

@Test
public void testTrimOptionProperty() throws Exception {
final String[] expected = {
"20:31: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, ";"),
};
verifyWithInlineConfigParser(
getPath("InputEmptyForIteratorPadToCheckTrimFunctionInOptionProperty.java"),
expected);

}

@Test
public void testUppercaseOptionProperty() throws Exception {
final String[] expected = {
"20:31: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, ";"),
};
verifyWithInlineConfigParser(
getPath("InputEmptyForIteratorPadToCheckUppercaseFunctionInOptionProperty.java"),
expected);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
EmptyForIteratorPad
option = \tSPACE


*/

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

class InputEmptyForIteratorPadToCheckTrimFunctionInOptionProperty {

void method() {

for (int i = 0; i < 1;i++ ) {
}

for (int i = 0; i < 1; i++ ) {
}

for (int i = 0; i < 1;) { // violation '';' is not followed by whitespace'
i++;
}

for (int i = 0; i < 1; ) { // ok
i++;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
EmptyForIteratorPad
option = space


*/

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

public class InputEmptyForIteratorPadToCheckUppercaseFunctionInOptionProperty {

void method() {

for (int i = 0; i < 1;i++ ) {
}

for (int i = 0; i < 1; i++ ) {
}

for (int i = 0; i < 1;) { // violation '';' is not followed by whitespace'
i++;
}

for (int i = 0; i < 1; ) { // ok
i++;
}
}
}