refactor: clean up code and enhance utilities with new functions

This commit is contained in:
yusing
2025-03-28 08:08:33 +08:00
parent 7707fc6f36
commit cdb3ffe439
9 changed files with 103 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
package utils
import (
"bytes"
"errors"
"os"
"reflect"
@@ -102,6 +103,14 @@ func ExpectDeepEqual[T any](t *testing.T, got T, want T) {
}
}
func ExpectBytesEqual(t *testing.T, got []byte, want []byte) {
t.Helper()
if !bytes.Equal(got, want) {
t.Errorf("expected:\n%v, got\n%v", want, got)
t.FailNow()
}
}
func ExpectTrue(t *testing.T, got bool) {
t.Helper()
if !got {