1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-11-11 07:40:56 +00:00
hosts/test/version.bats
William Melody 187222614a Use braces in all variable references.
Braces are only required in certain cases, but the cognitive overhead in
keeping track of which cases require braces can be reduced by simply
always using them.

Example: `${NAME}`

Retain more widely-used braces `$NAME` convention in documentation.
2016-02-23 18:14:21 -08:00

41 lines
1020 B
Bash

#!/usr/bin/env bats
load test_helper
@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\+'
}
@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\+'
}
# 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)" ]]
}