-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
We need to account for the extra function in the call stack when registering a custom fail handler, otherwise the line numbers that are reported on failures are incorrect, e.g.:
The solution is this:
RegisterFailHandler(func(message string, callerSkip ...int) {
// Your custom logic here...
// Account for this extra function in the call stack.
// Without this all failure messages will show the incorrect line number!
var shiftedCallerSkip []int
for _, i := range callerSkip {
shiftedCallerSkip = append(shiftedCallerSkip, i+1)
}
Fail(message, shiftedCallerSkip...)
})Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working