go-json/helper_test.go

25 lines
557 B
Go
Raw Normal View History

2020-04-24 14:48:15 +03:00
package json_test
import "testing"
func assertErr(t *testing.T, err error) {
t.Helper()
if err != nil {
t.Fatalf("%+v", err)
}
}
func assertEq(t *testing.T, msg string, exp interface{}, act interface{}) {
t.Helper()
2021-06-23 17:00:41 +03:00
if exp != act && !(exp == nil && act == nil) {
2020-04-24 14:48:15 +03:00
t.Fatalf("failed to test for %s. exp=[%v] but act=[%v]", msg, exp, act)
}
}
2020-08-08 07:20:42 +03:00
func assertNeq(t *testing.T, msg string, exp interface{}, act interface{}) {
t.Helper()
if exp == act {
t.Fatalf("failed to test for %s. expected value is not [%v] but got same value", msg, act)
}
}