1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-11-22 04:45:11 +00:00
hosts/test/hosts.bats
2020-05-17 11:33:57 -07:00

19 lines
548 B
Bash

#!/usr/bin/env bats
load test_helper
@test "\`hosts\` with no arguments exits with status 0." {
run "${_HOSTS}"
[ "${status}" -eq 0 ]
}
@test "\`hosts\` with no arguments prints enabled rules." {
run "${_HOSTS}"
[[ "${#lines[@]}" -eq 4 ]]
[[ "${lines[0]}" =~ 127.0.0.1[[:space:]]+localhost ]]
[[ "${lines[1]}" =~ 255.255.255.255[[:space:]]+broadcasthost ]]
[[ "${lines[2]}" =~ \:\:1[[:space:]]+localhost ]]
[[ "${lines[3]}" =~ fe80\:\:1\%lo0[[:space:]]+localhost ]]
[[ "${lines[4]}" == "" ]]
}