testing: Docs unclear what Cleanup does when called in a subtest. #37333
Labels
Documentation
Issues describing a change to documentation.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
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?
Ran t.Cleanup in a subtest:
What did you expect to see?
I didn't know, from the docs I knew that a test function's cleanups run after the test and all subtests finish, but I don't know what happens when you register a cleanup function in a subtest.
The docs say: "Cleanup registers a function to be called when the test and all its subtests complete. Cleanup functions will be called in last added, first called order."
What did you see instead?
I learned that cleanup functions registered in subtests get run at the end of that subtest, but I don't know if this behaviour is intended or stable?
Could the docs be expanded to reflect the intention?
The text was updated successfully, but these errors were encountered: