1
0
mirror of https://github.com/golang/go synced 2024-11-11 23:20:24 -07:00

testing: clarify that Cleanup is run after subtests complete.

It's good to be explicit, as it's not necessarily obvious (and indeed
the behavior has changed recently with https://go-review.googlesource.com/c/go/+/214822)
without an associated doc comment change).

Change-Id: I99d6398bf15b404b1b1b196e712e926e363251e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/215217
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Roger Peppe 2020-01-17 09:06:13 +00:00 committed by roger peppe
parent c112289ee4
commit 03eeaa9656

View File

@ -776,9 +776,9 @@ func (c *common) Helper() {
c.helpers[callerName(1)] = struct{}{}
}
// Cleanup registers a function to be called when the test finishes.
// Cleanup functions will be called in last added, first called
// order.
// 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.
func (c *common) Cleanup(f func()) {
c.mu.Lock()
defer c.mu.Unlock()