func AssertPanic(t *testing.T, cb func(), ctx ...interface{}) {
	defer func() {
		v := recover()
		if v == nil {
			t.Errorf("expected callback to panic, but it didn't%s", ctxString(ctx))
		}
	}()
	cb()
}
AssertPanic expects the callback function to panic, otherwise
logs an error with t.Errorf
package restest
import (
	"encoding/json"
	"fmt"
	"reflect"
	"testing"
	res "github.com/jirenius/go-res"
)
func AssertEqualJSON(t *testing.T, name string, result, expected interface{}, ctx ...interface{}) bool {
	aa, aj := jsonMap(t, result)
	bb, bj := jsonMap(t, expected)
	if !reflect.DeepEqual(aa, bb) {
		t.Fatalf("expected %s to be:\n\t%s\nbut got:\n\t%s%s", name, bj, aj, ctxString(ctx))
		return false
	}
	return true
}
func AssertTrue(t *testing.T, expectation string, isTrue bool, ctx ...interface{}) bool {
	if !isTrue {
		t.Fatalf("expected %s%s", expectation, ctxString(ctx))
		return false
	}
	return true
}
func AssertNoError(t *testing.T, err error, ctx ...interface{}) {
	if err != nil {
		t.Fatalf("expected no error but got:\n%s%s", err, ctxString(ctx))
	}
}
func AssertError(t *testing.T, err error, ctx ...interface{}) {
	if err == nil {
		t.Fatalf("expected an error but got none%s", ctxString(ctx))
	}
}
func AssertResError(t *testing.T, err error, rerr *res.Error, ctx ...interface{}) {
	AssertError(t, err, ctx...)
	v, ok := err.(*res.Error)
	if !ok {
		t.Fatalf("expected error to be of type *res.Error%s", ctxString(ctx))
	}
	AssertEqualJSON(t, "error", v, rerr, ctx...)
}
func AssertErrorCode(t *testing.T, err error, code string, ctx ...interface{}) {
	AssertError(t, err, ctx...)
	v, ok := err.(*res.Error)
	if !ok {
		t.Fatalf("expected error to be of type *res.Error%s", ctxString(ctx))
	}
	AssertEqualJSON(t, "error code", v.Code, code, ctx...)
}