package user import "testing" func TestValidateEmail(t *testing.T) { cases := []struct { email string wantErr bool }{ {"a@b.de", false}, {"a.b+c@sub.example.com", false}, {"", true}, {"keine-email", true}, {"a@b", true}, {"@b.de", true}, } for _, c := range cases { err := ValidateEmail(c.email) if (err != nil) != c.wantErr { t.Errorf("ValidateEmail(%q) error = %v, wantErr %v", c.email, err, c.wantErr) } } }