standardise all validate tests

This commit is contained in:
Aneurin Barker Snook
2023-10-08 15:21:02 +01:00
parent c74486d122
commit 7cb1900ec1
6 changed files with 65 additions and 113 deletions
+4 -12
View File
@@ -27,20 +27,12 @@ func TestAll(t *testing.T) {
}
for _, tc := range testCases {
t.Logf("%q", tc.Input)
t.Logf("Testing %q", tc.Input)
err := tc.F(tc.Input)
if tc.Err != nil {
if err == nil {
t.Errorf("Expected %s; got nil", tc.Err)
}
if err != tc.Err {
t.Errorf("Expected %s; got %s", tc.Err, err)
}
} else {
if err != nil {
t.Errorf("Expected nil; got %s", err)
}
if err != tc.Err {
t.Errorf("Expected error %v, got %v", tc.Err, err)
}
}
}