fix(internal): test.Error caller information

This commit is contained in:
Tit Petric
2019-02-21 20:56:52 +01:00
parent 87a5d96852
commit cef557e1ee
+8 -2
View File
@@ -26,6 +26,12 @@ func NoError(t *testing.T, err error, format string, args ...interface{}) bool {
return true
}
func Error(t *testing.T, err error, message string) {
Assert(t, err != nil, message)
func Error(t *testing.T, err error, format string, args ...interface{}) bool {
if err == nil {
_, file, line, _ := runtime.Caller(1)
caller := fmt.Sprintf("\nAsserted at:%s:%d", file, line)
t.Fatalf(format+caller, args...)
return false
}
return true
}