Accept an interface instead of testing.T (#1)

This commit is contained in:
Crow Crowcrow 2020-01-17 22:36:24 +01:00 committed by Gitea
parent 66ad00ea84
commit fe8a28286e
3 changed files with 10 additions and 5 deletions

View file

@ -5,7 +5,6 @@ import (
"reflect"
"runtime"
"strconv"
"testing"
)
func prepMsg(msg []interface{}, format string, args ...interface{}) []interface{} {
@ -16,9 +15,9 @@ func shell(i int) string {
return "\x1B[" + strconv.Itoa(i) + "m"
}
var ts = map[*runtime.Func]*testing.T{}
var ts = map[*runtime.Func]T{}
func t(a Assert) *testing.T {
func t(a Assert) T {
f := runtime.FuncForPC(reflect.ValueOf(a).Pointer())
return ts[f]
}