From d88d819a19e52fcf272fa19c500c20e117f1e005 Mon Sep 17 00:00:00 2001 From: William Melody Date: Tue, 26 Jan 2016 19:01:02 -0800 Subject: [PATCH] Add help tests to add.bats. --- test/add.bats | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/add.bats b/test/add.bats index 5a20d61..0b88031 100644 --- a/test/add.bats +++ b/test/add.bats @@ -110,3 +110,18 @@ load test_helper [[ "${lines[0]}" == "Added:" ]] [[ "${lines[1]}" == "0.0.0.0 example.com # Comment." ]] } + +# help ######################################################################## + +@test "\`help add\` exits with status 0." { + run "$_HOSTS" help add + [[ $status -eq 0 ]] +} + +@test "\`help add\` prints help information." { + run "$_HOSTS" help add + printf "\$status: %s\n" "$status" + printf "\$output: '%s'\n" "$output" + [[ "${lines[0]}" == "Usage:" ]] + [[ "${lines[1]}" == " hosts add [comment]" ]] +}