-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
85 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
htmlSanityCheck-cli/src/test/groovy/org/aim42/htmlsanitycheck/cli/MainCliSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.aim42.htmlsanitycheck.cli | ||
|
||
|
||
import picocli.CommandLine | ||
import spock.lang.Specification | ||
import spock.lang.Unroll | ||
|
||
class MainCliSpec extends Specification { | ||
|
||
Main.MainRunner myAppRunner = Mock(Main.MainRunner) | ||
|
||
@Unroll | ||
def "test hsc with #args"() { | ||
given: | ||
def cmdLine = new CommandLine(new Main(myAppRunner)) | ||
|
||
when: | ||
def exitCode = cmdLine.execute(args.split()) | ||
|
||
then: | ||
exitCode == expectedExitCode | ||
(runnerWasCalled ? 1 : 0) * myAppRunner.run() | ||
|
||
where: | ||
args | expectedExitCode | runnerWasCalled | ||
"-h" | 0 | false | ||
"--help" | 0 | false | ||
"-V" | 0 | false | ||
"--version" | 0 | false | ||
"" | 0 | true | ||
"." | 0 | true | ||
"-r /tmp/results" | 0 | true | ||
"--resultsDir /tmp/results" | 0 | true | ||
} | ||
} |