]> Cypherpunks repositories - gostls13.git/commitdiff
testing: clarify that Cleanup is run after subtests complete.
authorRoger Peppe <rogpeppe@gmail.com>
Fri, 17 Jan 2020 09:06:13 +0000 (09:06 +0000)
committerroger peppe <rogpeppe@gmail.com>
Sat, 18 Jan 2020 08:45:35 +0000 (08:45 +0000)
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>
src/testing/testing.go

index a875fe145f6d912b09e80878b8e1e9f5740f735a..030feb71126bafc4b5337d3296a792820a1cf2fc 100644 (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()