testing: t.Cleanup should report non-helper caller information #38800
Labels
FrozenDueToAge
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Used
t.Cleanup
and passed int.Helper
so that the original caller of theCleanup
function would be mentionedhttps://play.golang.org/p/AzLAUWwuSGJ
What did you expect to see?
Some mention of the non-helper file:line that called a helper function that then used a cleanup.
E.g.,
It may also want to mention cleanup from that line
What did you see instead?
Note, removing the
t.Helper
inside the cleanup results in the helperCreate
function showing up:Other Details
Only the testing library knows about which methods in the callstack have called
t.Helper
, so it's not possible for the helper function to track caller itself and report it in theCleanup
function. Ideally, at the point ofCleanup
, the caller information is recorded, so it can be used for failures in cleanup.The text was updated successfully, but these errors were encountered: