mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
testing: clarify rules for concurrent t.Run calls
Apparently, "all such calls must happen" means that the t.Run call must *return* before the outer test function returns, or the calls will cause a data race on t.ran. Clarify the docs. Fixes #20339 Change-Id: I191a9af2a9095be1e0aaf10b79c30e00a9c495cb Reviewed-on: https://go-review.googlesource.com/47150 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
6b8813ca45
commit
68e1b3e361
2 changed files with 2 additions and 2 deletions
|
|
@ -760,7 +760,7 @@ func tRunner(t *T, fn func(t *T)) {
|
|||
// have completed.
|
||||
//
|
||||
// Run may be called simultaneously from multiple goroutines, but all such calls
|
||||
// must happen before the outer test function for t returns.
|
||||
// must return before the outer test function for t returns.
|
||||
func (t *T) Run(name string, f func(t *T)) bool {
|
||||
atomic.StoreInt32(&t.hasSub, 1)
|
||||
testName, ok, _ := t.context.match.fullName(&t.common, name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue