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