Cleaned up some validation code, stricter validation

This commit is contained in:
yusing
2025-01-26 14:43:48 +08:00
parent 254224c0e8
commit 1586610a44
23 changed files with 590 additions and 468 deletions

View File

@@ -35,6 +35,14 @@ func ExpectNoError(t *testing.T, err error) {
}
}
func ExpectHasError(t *testing.T, err error) {
t.Helper()
if errors.Is(err, nil) {
t.Error("expected err not nil")
t.FailNow()
}
}
func ExpectError(t *testing.T, expected error, err error) {
t.Helper()
if !errors.Is(err, expected) {