Skip to content

Commit

Permalink
Add a test that ./demo SimpleSample.java works correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
netdpb committed Dec 21, 2023
1 parent bb16360 commit eba0188
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Build and Test
uses: gradle/gradle-build-action@v2
with:
arguments: build conformanceTests
arguments: build conformanceTests demoTest
env:
SHALLOW: 1
- name: Check out jspecify/samples-google-prototype
Expand Down
16 changes: 16 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,22 @@ clean.doFirst {
delete "${rootDir}/tests/build/"
}

tasks.register('demoTest', Exec) {
group = 'verification'
shouldRunAfter conformanceTests
dependsOn assemble
inputs.files('demo', 'SimpleSample.java')
executable '/bin/sh'
args 'demo', 'SimpleSample.java'
ignoreExitValue = true
errorOutput = new ByteArrayOutputStream()
doLast {
if (!errorOutput.toString().startsWith("SimpleSample.java:7: error:")) {
throw new AssertionError("`./demo SimpleSample.java` did not run correctly. Error output:\n$errorOutput")
}
}
}

/*
Spotless validates its formatters' dependencies eagerly, on project configuration.
google-java-format depends on checker-qual, which is built by a subproject.
Expand Down

0 comments on commit eba0188

Please sign in to comment.