Skip to content

Commit 6ae2131

Browse files
committed
add trace to expect calls
1 parent 24b0554 commit 6ae2131

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

util_test.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
package aep
22

3-
import "testing"
3+
import (
4+
"runtime"
5+
"strings"
6+
"testing"
7+
)
48

59
func expect(t *testing.T, values ...interface{}) {
10+
_, path, line, _ := runtime.Caller(1)
11+
file := strings.Split(path, "/")[len(strings.Split(path, "/"))-1]
612
if len(values) >= 1 {
713
if res, ok := values[0].(bool); ok {
814
if !res {
915
if len(values) > 1 {
1016
t.Fatal(values[1])
1117
} else {
12-
t.Fatalf("Expected true value\n")
18+
t.Fatalf("(%s:%d) Expected true value\n", file, line)
1319
}
1420
}
1521
} else {
1622
if values[0] != values[1] {
1723
if len(values) > 2 {
1824
t.Fatal(values[2])
1925
} else {
20-
t.Fatalf("Expected %+v to equal %+v\n", values[0], values[1])
26+
t.Fatalf("(%s:%d) Expected \"%+v\" to equal \"%+v\"\n", file, line, values[0], values[1])
2127
}
2228
}
2329
}

0 commit comments

Comments
 (0)