mirror of
https://github.com/octoleo/hosts.git
synced 2024-11-26 06:46:43 +00:00
187222614a
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.
29 lines
666 B
Bash
29 lines
666 B
Bash
#!/usr/bin/env bats
|
|
|
|
load test_helper
|
|
|
|
@test "\`file\` exits with status 0." {
|
|
run "${_HOSTS}" file
|
|
[ "${status}" -eq 0 ]
|
|
}
|
|
|
|
@test "\`file\` prints \$HOSTS_PATH contents." {
|
|
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" ]]
|
|
}
|