28 lines
543 B
Go
28 lines
543 B
Go
package fixtures
|
|
|
|
import "testing"
|
|
|
|
func AssertEq[C comparable](t *testing.T, context string, expected, actual C) {
|
|
if expected != actual {
|
|
t.Errorf("%s: %#v != %#v", context, expected, actual)
|
|
}
|
|
}
|
|
|
|
func Assert(t *testing.T, context string, condition bool) {
|
|
if !condition {
|
|
t.Errorf("%s", context)
|
|
}
|
|
}
|
|
|
|
func FatalAssert(t *testing.T, context string, condition bool) {
|
|
if !condition {
|
|
t.Fatalf("%s", context)
|
|
}
|
|
}
|
|
|
|
func FailIfErr(t *testing.T, err error, context string) {
|
|
if err != nil {
|
|
t.Fatalf("%s: %s\n", context, err)
|
|
}
|
|
}
|