2016-01-25 19:27:49 -08:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load test_helper
|
|
|
|
|
|
|
|
@test "\`hosts version\` returns with 0 status." {
|
2016-02-23 18:14:21 -08:00
|
|
|
run "${_HOSTS}" version
|
|
|
|
[[ "${status}" -eq 0 ]]
|
2016-01-25 19:27:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "\`hosts version\` prints a version number." {
|
2016-02-23 18:14:21 -08:00
|
|
|
run "${_HOSTS}" version
|
|
|
|
printf "'%s'" "${output}"
|
2019-11-21 19:26:49 -08:00
|
|
|
echo "${output}" | grep -q '[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+'
|
2016-01-25 19:27:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "\`hosts --version\` returns with 0 status." {
|
2016-02-23 18:14:21 -08:00
|
|
|
run "${_HOSTS}" --version
|
|
|
|
[[ "${status}" -eq 0 ]]
|
2016-01-25 19:27:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "\`hosts --version\` prints a version number." {
|
2016-02-23 18:14:21 -08:00
|
|
|
run "${_HOSTS}" --version
|
|
|
|
printf "'%s'" "${output}"
|
2019-11-21 19:26:49 -08:00
|
|
|
echo "${output}" | grep -q '[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+'
|
2016-01-25 19:27:49 -08:00
|
|
|
}
|
2016-01-26 19:07:05 -08:00
|
|
|
|
|
|
|
# help ########################################################################
|
|
|
|
|
|
|
|
@test "\`help version\` exits with status 0." {
|
2016-02-23 18:14:21 -08:00
|
|
|
run "${_HOSTS}" help version
|
|
|
|
[[ ${status} -eq 0 ]]
|
2016-01-26 19:07:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "\`help version\` prints help information." {
|
2016-02-23 18:14:21 -08:00
|
|
|
run "${_HOSTS}" help version
|
2018-04-15 14:55:26 -07:00
|
|
|
printf "\${status}: %s\\n" "${status}"
|
|
|
|
printf "\${output}: '%s'\\n" "${output}"
|
2016-01-26 19:07:05 -08:00
|
|
|
[[ "${lines[0]}" == "Usage:" ]]
|
2016-01-26 20:25:16 -08:00
|
|
|
[[ "${lines[1]}" == " hosts (version | --version)" ]]
|
2016-01-26 19:07:05 -08:00
|
|
|
}
|