Skip to content

Commit

Permalink
Issue #12441: Resolve Pitest suppression for RightCurlyCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
arinmodi authored and nrmancuso committed Nov 27, 2022
1 parent 858dcaa commit a844187
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
9 changes: 0 additions & 9 deletions config/pitest-suppressions/pitest-blocks-suppressions.xml
Expand Up @@ -135,15 +135,6 @@
<lineContent>switch (ast.getType()) {</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>RightCurlyCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck$Details</mutatedClass>
<mutatedMethod>getDetailsForIfElse</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck$Details::getNextToken</description>
<lineContent>nextToken = getNextToken(ast);</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>RightCurlyCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck$Details</mutatedClass>
Expand Down
Expand Up @@ -649,4 +649,14 @@ public void testUppercaseOptionProperty() throws Exception {
verifyWithInlineConfigParser(
getPath("InputRightCurlyWithUppercaseOptionProperty.java"), expected);
}

@Test
public void testRightCurlyWithIfElseAlone() throws Exception {
final String[] expected = {
"19:12: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", 12),
"27:9: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", 9),
};
verifyWithInlineConfigParser(
getPath("InputRightCurlyTestIfElseAlone.java"), expected);
}
}
@@ -0,0 +1,32 @@
/*
RightCurly
option = ALONE
tokens = LITERAL_IF, LITERAL_ELSE
*/

package com.puppycrawl.tools.checkstyle.checks.blocks.rightcurly;

public class InputRightCurlyTestIfElseAlone {

public void test() {
int id = 0;
switch (id) {
case 0: break;
case 1: if (1 == 0) {
break;
}; // violation ''}' at column 12 should be alone on a line.'
case 2: break;
}
}

public void test2() {
if(true) {

} if(false) { // violation ''}' at column 9 should be alone on a line.'

}
}

}

0 comments on commit a844187

Please sign in to comment.