Skip to content

Commit

Permalink
Execute cliargs script before running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ethauvin committed May 28, 2024
1 parent 7aa0319 commit aa6d6a7
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 21 deletions.
16 changes: 0 additions & 16 deletions checkcliargs.sh

This file was deleted.

1 change: 1 addition & 0 deletions lib/bld/bld-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
16 changes: 16 additions & 0 deletions scripts/checkcliargs.sh
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
9 changes: 9 additions & 0 deletions src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,13 @@ public void pmd() {
.ruleSets("config/pmd.xml")
.execute();
}

@Override
public void test() throws Exception {
new ExecOperation()
.fromProject(this)
.command("scripts/cliargs.sh")
.execute();
super.test();
}
}
10 changes: 5 additions & 5 deletions src/test/java/rife/bld/extension/CheckstyleOperationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ void branchMatchingXpath() {

@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")
Expand All @@ -70,9 +70,9 @@ void checkAllParameters() throws IOException {
.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;
Expand Down

0 comments on commit aa6d6a7

Please sign in to comment.