From abfd442c3d9b241ce7ceb23032613b4b10a2e832 Mon Sep 17 00:00:00 2001 From: William Melody Date: Tue, 26 Jan 2016 19:05:47 -0800 Subject: [PATCH] Add help tests to file.bats. --- test/file.bats | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/file.bats b/test/file.bats index 8806f58..b907112 100644 --- a/test/file.bats +++ b/test/file.bats @@ -11,3 +11,18 @@ load test_helper run "$_HOSTS" file [[ "$output" == "$(cat $HOSTS_PATH)" ]] } + +# help ######################################################################## + +@test "\`help file\` exits with status 0." { + run "$_HOSTS" help file + [[ $status -eq 0 ]] +} + +@test "\`help file\` prints help information." { + run "$_HOSTS" help file + printf "\$status: %s\n" "$status" + printf "\$output: '%s'\n" "$output" + [[ "${lines[0]}" == "Usage:" ]] + [[ "${lines[1]}" == " hosts file" ]] +}