-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testing: allow marking subtest function as Helper #24128
Comments
Dup of #23249 |
Not a duplicate. #23249 deals with using Helper within a closure over a testing.TB value. This issue deals with the constraint stated by the documentation of the Run method:
|
It seems to me that the concrete issue you are reporting in this thread is the bad lines in the failure messages
If the issue reported in the thread I linked above (Helper's highest function call's information should be maintained for any subsequent/nested calls) is fixed in a general way, wouldn't this also fix the problem you are reporting here? |
Both issues have similar errors, bad lines in the failure messages. However the reasons are very different. Therefore a solution to #23249 may not be a solution to my issue, that basically requires removing the effect of the following lines in the Helper documentation (wrongly reported as Run documentation in my last comment):
|
I see. Leaving this open, then. |
It seems like this should work. The intent of the code is clear, even though it will require a special case at the intersection of subtests and Helper. /cc @mpvl |
Change https://golang.org/cl/108658 mentions this issue: |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10 windows/amd64
What did you do?
Run the following program with "go test":
helper.go:
package helper
helper_test.go:
What did you expect to see?
What did you see instead?
The reported error line is 16 instead of 8, where the test data are defined. This makes it difficult to use the Run method to define a generic test on a list of cases. I would expect the Run method to be marked as a test helper by default. If the subtesting function is marked as helper, the reported line should be the line of the function that calls the Run method (unless skipped by the Helper mark).
The text was updated successfully, but these errors were encountered: