diff --git a/api/main_test.go b/api/main_test.go index b395be0..9e08553 100644 --- a/api/main_test.go +++ b/api/main_test.go @@ -7,7 +7,7 @@ import ( func TestInvalidIP(t *testing.T) { _, err := generateJSON("foo") errwant := "invalid IP" - if err.Error() != errwant { + if err == nil || err.Error() != errwant { t.Fatalf(`generateJSON("foo") == "%v", wants "%s"`, err, errwant) } } @@ -15,7 +15,7 @@ func TestInvalidIP(t *testing.T) { func TestInaccessibleIP(t *testing.T) { _, err := generateJSON("0.0.0.0") errwant := "unspecified IP" - if err.Error() != errwant { + if err == nil || err.Error() != errwant { t.Fatalf(`generateJSON("0.0.0.0") == "%v", wants "%s"`, err, errwant) } }