Read parameters from resource file

This commit is contained in:
Erik C. Thauvin 2024-05-27 20:38:53 -07:00
parent 4de2b0b3f1
commit 7aa0319d4d
Signed by: erik
GPG key ID: 776702A6A2DA330E
3 changed files with 24 additions and 22 deletions

View file

@ -2,6 +2,5 @@
java -cp "lib/test/*" com.puppycrawl.tools.checkstyle.Main --help |\ java -cp "lib/test/*" com.puppycrawl.tools.checkstyle.Main --help |\
grep "^ -.*" |\ grep "^ -.*" |\
sed -e "s/ -/-/" -e "s/[,=].*//" -e "s/-/\"-/" -e "s/$/\",/" |\ sed -e "s/ -/-/" -e "s/[,=].*//" -e '/-V/d' -e '/-h/d' |\
sed -e '$s/,//' -e '/-V/d' -e '/-h/d' |\ sort > "src/test/resources/checkstyle-args.txt"
sort

View file

@ -24,6 +24,8 @@ import rife.bld.operations.exceptions.ExitStatusException;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List; import java.util.List;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -43,25 +45,10 @@ class CheckstyleOperationTest {
} }
@Test @Test
void checkAllParameters() { void checkAllParameters() throws IOException {
var params = List.of( var params = Files.readAllLines(Paths.get("src", "test", "resources", "checkstyle-args.txt"));
"-b",
"-c", assertThat(params).isNotEmpty();
"-d",
"-e",
"-E",
"-f",
"-g",
"-j",
"-J",
"-o",
"-p",
"-s",
"-t",
"-T",
"-w",
"-x"
);
var args = new CheckstyleOperation() var args = new CheckstyleOperation()
.fromProject(new Project()) .fromProject(new Project())

View file

@ -0,0 +1,16 @@
-b
-c
-d
-e
-E
-f
-g
-j
-J
-o
-p
-s
-t
-T
-w
-x