From cef557e1eeb1b44790d250b517cb96d5abb83e6a Mon Sep 17 00:00:00 2001 From: Tit Petric Date: Thu, 21 Feb 2019 20:55:53 +0100 Subject: [PATCH] fix(internal): test.Error caller information --- internal/test/assert.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/test/assert.go b/internal/test/assert.go index d37381824..ed205f3fd 100644 --- a/internal/test/assert.go +++ b/internal/test/assert.go @@ -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 }