2016-01-26 03:27:49 +00:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load test_helper
|
|
|
|
|
|
|
|
@test "\`hosts version\` returns with 0 status." {
|
2016-01-27 03:07:28 +00:00
|
|
|
run "$_HOSTS" version
|
2016-01-26 03:27:49 +00:00
|
|
|
[[ "$status" -eq 0 ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "\`hosts version\` prints a version number." {
|
2016-01-27 03:07:28 +00:00
|
|
|
run "$_HOSTS" version
|
2016-01-26 03:27:49 +00:00
|
|
|
printf "'%s'" "$output"
|
|
|
|
echo "$output" | grep -q '\d\+\.\d\+\.\d\+'
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "\`hosts --version\` returns with 0 status." {
|
|
|
|
run "$_HOSTS" --version
|
|
|
|
[[ "$status" -eq 0 ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "\`hosts --version\` prints a version number." {
|
|
|
|
run "$_HOSTS" --version
|
|
|
|
printf "'%s'" "$output"
|
|
|
|
echo "$output" | grep -q '\d\+\.\d\+\.\d\+'
|
|
|
|
}
|
2016-01-27 03:07:05 +00:00
|
|
|
|
|
|
|
# help ########################################################################
|
|
|
|
|
|
|
|
@test "\`help version\` exits with status 0." {
|
|
|
|
run "$_HOSTS" help version
|
|
|
|
[[ $status -eq 0 ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "\`help version\` prints help information." {
|
|
|
|
run "$_HOSTS" help version
|
|
|
|
printf "\$status: %s\n" "$status"
|
|
|
|
printf "\$output: '%s'\n" "$output"
|
|
|
|
[[ "${lines[0]}" == "Usage:" ]]
|
|
|
|
[[ "${lines[1]}" == " hosts ( version | --version )" ]]
|
|
|
|
}
|