2016-01-24 21:21:40 -08:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load test_helper
|
|
|
|
|
|
|
|
@test "\`file\` exits with status 0." {
|
2016-02-23 18:14:21 -08:00
|
|
|
run "${_HOSTS}" file
|
|
|
|
[ "${status}" -eq 0 ]
|
2016-01-24 21:21:40 -08:00
|
|
|
}
|
|
|
|
|
2016-01-24 21:26:18 -08:00
|
|
|
@test "\`file\` prints \$HOSTS_PATH contents." {
|
2016-02-23 18:14:21 -08:00
|
|
|
run "${_HOSTS}" file
|
|
|
|
[[ "${output}" == "$(cat ${HOSTS_PATH})" ]]
|
2016-01-24 21:21:40 -08:00
|
|
|
}
|
2016-01-26 19:05:47 -08:00
|
|
|
|
|
|
|
# help ########################################################################
|
|
|
|
|
|
|
|
@test "\`help file\` exits with status 0." {
|
2016-02-23 18:14:21 -08:00
|
|
|
run "${_HOSTS}" help file
|
|
|
|
[[ ${status} -eq 0 ]]
|
2016-01-26 19:05:47 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "\`help file\` prints help information." {
|
2016-02-23 18:14:21 -08:00
|
|
|
run "${_HOSTS}" help file
|
2018-04-15 14:55:26 -07:00
|
|
|
printf "\${status}: %s\\n" "${status}"
|
|
|
|
printf "\${output}: '%s'\\n" "${output}"
|
2016-01-26 19:05:47 -08:00
|
|
|
[[ "${lines[0]}" == "Usage:" ]]
|
|
|
|
[[ "${lines[1]}" == " hosts file" ]]
|
|
|
|
}
|