package main import "testing" func TestValidateLogin(t *testing.T) { tests := []struct { name, email, password string wantErr bool }{ {"valid", "a@example.com", "secret", false}, {"empty email", "", "secret", true}, {"empty password", "a@example.com", "", true}, {"both empty", "", "", true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := validateLogin(tt.email, tt.password) if (err != nil) != tt.wantErr { t.Errorf("validateLogin(%q, %q) error = %v, wantErr %v", tt.email, tt.password, err, tt.wantErr) } }) } }