Execute cliargs script before running tests

This commit is contained in:
Erik C. Thauvin 2024-05-28 14:01:45 -07:00
parent 7aa0319d4d
commit aa6d6a70b0
Signed by: erik
GPG key ID: 776702A6A2DA330E
6 changed files with 31 additions and 21 deletions

View file

@ -1,16 +0,0 @@
#!/bin/bash
MAIN="com.puppycrawl.tools.checkstyle.Main"
TMPNEW=/tmp/checkcliargs-new
TMPOLD=/tmp/checkcliargs-old
java -cp "lib/test/*" $MAIN --help >$TMPNEW
java -cp "examples/lib/test/*" $MAIN --help >$TMPOLD
if [ "$1" == "-v" ]; then
code --wait --diff $TMPOLD $TMPNEW
else
diff $TMPOLD $TMPNEW
fi
rm -rf $TMPNEW $TMPOLD

View file

@ -2,6 +2,7 @@ bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.9
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.5
bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.0
bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=

16
scripts/checkcliargs.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
main="com.puppycrawl.tools.checkstyle.Main"
new=/tmp/checkcliargs-new
old=/tmp/checkcliargs-old
java -cp "lib/test/*" $main --help >$new
java -cp "examples/lib/test/*" $main --help >$old
if [ "$1" == "-v" ]; then
code --wait --diff $old $new
else
diff $old $new
fi
rm -rf $new $old

View file

@ -104,4 +104,13 @@ public class CheckstyleOperationBuild extends Project {
.ruleSets("config/pmd.xml")
.execute();
}
@Override
public void test() throws Exception {
new ExecOperation()
.fromProject(this)
.command("scripts/cliargs.sh")
.execute();
super.test();
}
}

View file

@ -46,11 +46,11 @@ class CheckstyleOperationTest {
@Test
void checkAllParameters() throws IOException {
var params = Files.readAllLines(Paths.get("src", "test", "resources", "checkstyle-args.txt"));
var args = Files.readAllLines(Paths.get("src", "test", "resources", "checkstyle-args.txt"));
assertThat(params).isNotEmpty();
assertThat(args).isNotEmpty();
var args = new CheckstyleOperation()
var params = new CheckstyleOperation()
.fromProject(new Project())
.branchMatchingXpath("xpath")
.configurationFile("config")
@ -70,9 +70,9 @@ class CheckstyleOperationTest {
.treeWithJavadoc(true)
.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;