Initial commit
This commit is contained in:
commit
977c232584
2 changed files with 184 additions and 0 deletions
24
helper.go
Normal file
24
helper.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package assert
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func prepMsg(msg []interface{}, format string, args ...interface{}) []interface{} {
|
||||
return append(msg, "\n\n", fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
func shell(i int) string {
|
||||
return "\x1B[" + strconv.Itoa(i) + "m"
|
||||
}
|
||||
|
||||
var ts = map[*runtime.Func]*testing.T{}
|
||||
|
||||
func t(a Assert) *testing.T {
|
||||
f := runtime.FuncForPC(reflect.ValueOf(a).Pointer())
|
||||
return ts[f]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue