mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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:
parent
c112289ee4
commit
03eeaa9656
1 changed files with 3 additions and 3 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue