Skip to content

Commit

Permalink
Read arguments from resource file
Browse files Browse the repository at this point in the history
  • Loading branch information
ethauvin committed May 28, 2024
1 parent e7ed7ed commit ec50e52
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 56 deletions.
4 changes: 2 additions & 2 deletions cliargs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

java -cp "lib/test/*" org.pitest.mutationtest.commandline.MutationCoverageReport --help |\
grep "^.*--.*" |\
sed -e "s/\* --/--/" -e "s/ .*//" -e "s/^--/\"--/" -e "s/$/\",/" |\
sed -e "s/\* --/--/" -e "s/ .*//" |\
sort |\
sed -e '/testPlugin/d' -e '/--help/d' -e '/---/d' -e '$s/,//'
sed -e '/testPlugin/d' -e '/--help/d' -e '/---/d' > src/test/resources/pitest-args.txt
63 changes: 9 additions & 54 deletions src/test/java/rife/bld/extension/PitestOperationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.Set;

Expand Down Expand Up @@ -58,58 +59,12 @@ void avoidCallsTo() {
}

@Test
void checkAllParameters() {
var params = List.of(
"--argLine",
"--avoidCallsTo",
"--classPath",
"--classPathFile",
"--coverageThreshold",
"--detectInlinedCode",
"--excludedClasses",
"--excludedGroups",
"--excludedMethods",
"--excludedRunners",
"--excludedTestClasses",
"--exportLineCoverage",
"--failWhenNoMutations",
"--features",
"--fullMutationMatrix",
"--historyInputLocation",
"--historyOutputLocation",
"--includedGroups",
"--includedTestMethods",
"--includeLaunchClasspath",
"--inputEncoding",
"--jvmArgs",
"--jvmPath",
"--maxMutationsPerClass",
"--maxSurviving",
"--mutableCodePaths",
"--mutationEngine",
"--mutationThreshold",
"--mutationUnitSize",
"--mutators",
"--outputEncoding",
"--outputFormats",
"--pluginConfiguration",
"--projectBase",
"--reportDir",
"--skipFailingTests",
"--sourceDirs",
"--targetClasses",
"--targetTests",
"--testStrengthThreshold",
"--threads",
"--timeoutConst",
"--timeoutFactor",
"--timestampedReports",
"--useClasspathJar",
"--verbose",
"--verbosity"
);

var args = new PitestOperation()
void checkAllParameters() throws IOException {
var args = Files.readAllLines(Paths.get("src", "test", "resources", "pitest-args.txt"));

assertThat(args).hasSizeGreaterThan(0);

var params = new PitestOperation()
.fromProject(new BaseProject())
.argLine(FOO)
.avoidCallsTo(FOO, BAR)
Expand Down Expand Up @@ -162,9 +117,9 @@ void checkAllParameters() {
.verbosity("default")
.executeConstructProcessCommandList();

for (var p : params) {
for (var p : args) {
var found = false;
for (var a : args) {
for (var a : params) {
if (a.startsWith(p)) {
found = true;
break;
Expand Down
47 changes: 47 additions & 0 deletions src/test/resources/pitest-args.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
--argLine
--avoidCallsTo
--classPath
--classPathFile
--coverageThreshold
--detectInlinedCode
--excludedClasses
--excludedGroups
--excludedMethods
--excludedRunners
--excludedTestClasses
--exportLineCoverage
--failWhenNoMutations
--features
--fullMutationMatrix
--historyInputLocation
--historyOutputLocation
--includedGroups
--includedTestMethods
--includeLaunchClasspath
--inputEncoding
--jvmArgs
--jvmPath
--maxMutationsPerClass
--maxSurviving
--mutableCodePaths
--mutationEngine
--mutationThreshold
--mutationUnitSize
--mutators
--outputEncoding
--outputFormats
--pluginConfiguration
--projectBase
--reportDir
--skipFailingTests
--sourceDirs
--targetClasses
--targetTests
--testStrengthThreshold
--threads
--timeoutConst
--timeoutFactor
--timestampedReports
--useClasspathJar
--verbose
--verbosity

0 comments on commit ec50e52

Please sign in to comment.