fix(stacktrace): avoid duplicates in stacktrace for anonymous functions#11
Open
fix(stacktrace): avoid duplicates in stacktrace for anonymous functions#11
Conversation
This change avoids printing the same line twice in caller stack-traces
when the direct caller to `t.Fatalf` is the same as the location that
invoked the assertion (`OrFail`, `For` or `Within`).
Such a situation can happen when the direct caller is an anonymous
function in the same line as the call to the assertion, for example:
With(t).Verify(...).Will(MatcherFunc(func(t T) { t.Fatalf(...) })).OrFail()
In this example both the call to `OrFail` as well as the direct call to
`t.Fatalf` is on the same line, and the caller stack trace would print
this line twice. This change prevents that.
b7debe2 to
3376a33
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change avoids printing the same line twice in caller stack-traces when the direct caller to
t.Fatalfis the same as the location that invoked the assertion (OrFail,FororWithin).Such a situation can happen when the direct caller is an anonymous function in the same line as the call to the assertion, for example:
In this example both the call to
OrFailas well as the direct call tot.Fatalfis on the same line, and the caller stack trace would print this line twice. This change prevents that.