aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorRoger Peppe <rogpeppe@gmail.com>2020-01-17 09:06:13 +0000
committerroger peppe <rogpeppe@gmail.com>2020-01-18 08:45:35 +0000
commit03eeaa9656027514113e7cd3dc2906255ee23963 (patch)
treebabdba7916d38f6d1936c46849c8f06e182c9b2b /src/testing
parentc112289ee4141ebc31db50328c355b01278b987b (diff)
downloadgo-03eeaa9656027514113e7cd3dc2906255ee23963.tar.gz
go-03eeaa9656027514113e7cd3dc2906255ee23963.zip
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>
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index a875fe145f..030feb7112 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -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()