From a7a62352c46b5d2b37baaa09f8145b1171ca79fb Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 14 Oct 2012 01:14:32 +0200 Subject: o Consistent output when the method is missing. --- test/01-help.bats | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/01-help.bats (limited to 'test') 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 ] +} -- cgit v1.2.3