diff --git a/test/remove.bats b/test/remove.bats index 7ef0103..24b70a5 100644 --- a/test/remove.bats +++ b/test/remove.bats @@ -28,6 +28,34 @@ load test_helper [[ "${lines[1]}" == " hosts remove ( | | ) [--force]" ]] } +# `hosts remove --force` ############################################ + +@test "\`remove --force\` exits with status 1." { + { + run "$_HOSTS" add 0.0.0.0 example.com + run "$_HOSTS" add 0.0.0.0 example.net + run "$_HOSTS" add 127.0.0.2 example.com + } + + run "$_HOSTS" remove 127.0.0.3 --force + printf "\$status: %s\n" "$status" + printf "\$output: '%s'\n" "$output" + [[ $status -eq 1 ]] +} + +@test "\`remove --force\` prints error message." { + { + run "$_HOSTS" add 0.0.0.0 example.com + run "$_HOSTS" add 0.0.0.0 example.net + run "$_HOSTS" add 127.0.0.2 example.com + } + + run "$_HOSTS" remove 127.0.0.3 --force + printf "\$status: %s\n" "$status" + printf "\$output: '%s'\n" "$output" + [[ $output == "No matching records found." ]] +} + # `hosts remove --force` ################################################# @test "\`remove --force\` exits with status 0." {