-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Description
Currently, when you have failed test, the filename+linenumber you get is where the assertion failed. This is suboptimal in situations where you do your assertions in some common test helper, e.g. assertMyCustomFormat(...).
I have created myself a function to work around this problem (see below), but it would be great if Go could do this out of the box. It would make the test failure output a little more wordy, but it is a time saver.
func Fatalf(t testing.TB, format string, args ...interface{}) {
trace := stackTrace()
format = format + "\n%s"
args = append(args, trace)
t.Fatalf(format, args...)
}Reactions are currently unavailable