summaryrefslogtreecommitdiff
path: root/test/01-help.bats
diff options
context:
space:
mode:
Diffstat (limited to 'test/01-help.bats')
-rw-r--r--test/01-help.bats33
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 ]
+}