Skip to content
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: document that TestMain always runs before any benchmarks #45764

Closed
opennota opened this issue Apr 26, 2021 · 2 comments
Closed

testing: document that TestMain always runs before any benchmarks #45764

opennota opened this issue Apr 26, 2021 · 2 comments

Comments

@opennota
Copy link

@opennota opennota commented Apr 26, 2021

The docs for TestMain say:

It is sometimes necessary for a test program to do extra setup
or teardown before or after testing.

https://golang.org/pkg/testing/#hdr-Main

But what if one needs to do extra setup before benchmarking? It appears that TestMain would also always run before benchmarks, but neither TestMain doc nor M.Run doc say anything about benchmarks.

@cherrymui cherrymui changed the title doc: document that TestMain always runs before any benchmarks testing: document that TestMain always runs before any benchmarks Apr 26, 2021
@cherrymui cherrymui added this to the Backlog milestone Apr 26, 2021
@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Apr 26, 2021

@gopherbot
Copy link

@gopherbot gopherbot commented Apr 27, 2021

Change https://golang.org/cl/314349 mentions this issue: testing: document that TestMain can be used with benchmarks

@gopherbot gopherbot closed this in 645cb62 Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants