diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-14 01:14:32 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-14 01:14:32 +0200 |
commit | a7a62352c46b5d2b37baaa09f8145b1171ca79fb (patch) | |
tree | 681d65114e9db978010e969a08ca18173e93f39d /test | |
parent | 3fc4ff425546670c979b8bc62e7debe5b5c1a77a (diff) | |
download | app.sh-a7a62352c46b5d2b37baaa09f8145b1171ca79fb.tar.gz app.sh-a7a62352c46b5d2b37baaa09f8145b1171ca79fb.tar.bz2 app.sh-a7a62352c46b5d2b37baaa09f8145b1171ca79fb.tar.xz app.sh-a7a62352c46b5d2b37baaa09f8145b1171ca79fb.zip |
o Consistent output when the method is missing.
Diffstat (limited to 'test')
-rw-r--r-- | test/01-help.bats | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/01-help.bats b/test/01-help.bats new file mode 100644 index 0000000..7d38592 --- /dev/null +++ b/test/01-help.bats @@ -0,0 +1,33 @@ +#!/bin/bash + +workdir=test-run + +# TODO: assert that the exit code is 1 for 'usage' outputs. +exit_usage=0 + +setup() { + rm -rf $workdir +} + +echo_lines() { + for line in "${lines[@]}"; do echo $line; done +} + +@test "./app" { + run ./app; echo_lines + [ $status -eq $exit_usage ] + [ $(expr "${lines[0]}" : "usage: ./app .*") -ne 0 ] +} + +@test "./app foo" { + run ./app foo; echo_lines + [ $status -eq $exit_usage ] + [ "${lines[0]}" = "Error: No such method group: foo" ] + [ $(expr "${lines[1]}" : "usage: ./app .*") -ne 0 ] +} + +@test "./app app" { + run ./app app; echo_lines + [ $status -eq $exit_usage ] + [ $(expr "${lines[0]}" : "usage: ./app app .*") -ne 0 ] +} |