1
0
Fork 0
go packages which are fine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
mediocre-go-lib/internal/massert/massert.go

26 lines
567 B

// massert helper assertion methods for tests.
package massert
import (
"reflect"
"testing"
)
// Equal fatals if reflect.DeepEqual fails.
func Equal[T any](t testing.TB, want, got T) {
t.Helper()
if !reflect.DeepEqual(want, got) {
t.Fatalf("%#v != %#v", want, got)
}
}
// Equalf is like Equal but extra formatting is appended.
func Equalf[T any](
t testing.TB, want, got T, fmtStr string, fmtArgs ...any,
) {
t.Helper()
if !reflect.DeepEqual(want, got) {
fmtArgs = append([]any{want, got}, fmtArgs...)
t.Fatalf("%#v != %#v "+fmtStr, fmtArgs...)
}
}