Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions config/pitest-suppressions/pitest-main-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,4 @@
<description>removed call to com/puppycrawl/tools/checkstyle/Main::getOutputStreamOptions</description>
<lineContent>getOutputStreamOptions(options.outputPath));</lineContent>
</mutation>

<mutation unstable="false">
<sourceFile>Main.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.Main$CliOptions</mutatedClass>
<mutatedMethod>getExclusions</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator</mutator>
<description>replaced call to java/util/stream/Stream::map with receiver</description>
<lineContent>.map(Pattern::quote)</lineContent>
</mutation>
</suppressedMutations>
28 changes: 28 additions & 0 deletions src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1978,6 +1978,34 @@ public void testPlainOutputFormatCreateListener() throws IOException {
.isInstanceOf(DefaultLogger.class);
}

@Test
public void testExcludeOptionDirectoryWithPlusInName(@SysErr Capturable systemErr,
@SysOut Capturable systemOut)
throws IOException {

final File specialDir = new File(temporaryFolder, "dir+name");
assertWithMessage("Directory must be created")
.that(specialDir.mkdirs())
.isTrue();

final File inputFile = new File(specialDir, "InputMainExclude.java");
Files.writeString(inputFile.toPath(),
"public class InputMainExclude { }" + System.lineSeparator());

final String dirPath = specialDir.getCanonicalPath();

assertMainReturnCode(-1, "-c", "/google_checks.xml", dirPath,
"-e", dirPath);

assertWithMessage("Unexpected output log")
.that(systemOut.getCapturedData())
.isEqualTo("Files to process must be specified, found 0."
+ System.lineSeparator());
assertWithMessage("Unexpected system error log")
.that(systemErr.getCapturedData())
.isEqualTo("");
}

/**
* Helper method to run {@link Main#main(String...)} and verify the exit code.
* Uses {@link Mockito#mockStatic(Class)} to mock method {@link Runtime#exit(int)}
Expand Down