From d45298671fb9a7d1fb6fd551476f138ed51dba8d Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 13 Dec 2017 20:04:43 -0500 Subject: [PATCH] testing: define Run result a little more clearly t.Run(f) does not wait for f after f calls t.Parallel. Otherwise it would be impossible to create new parallel sibling subtests for f. Fixes #22993. Change-Id: I27e1555ab1ff608eb8155db261d5e7ee8f486aef Reviewed-on: https://go-review.googlesource.com/83880 Run-TryBot: Russ Cox TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/testing/testing.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/testing/testing.go b/src/testing/testing.go index 402780ad64..1c3ed20585 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -781,9 +781,9 @@ func tRunner(t *T, fn func(t *T)) { t.finished = true } -// Run runs f as a subtest of t called name. It reports whether f succeeded. Run -// runs f in a separate goroutine and will block until all its parallel subtests -// have completed. +// Run runs f as a subtest of t called name. It runs f in a separate goroutine +// and blocks until f returns or calls t.Parallel to become a parallel test. +// Run reports whether f succeeded (or at least did not fail before calling t.Parallel). // // Run may be called simultaneously from multiple goroutines, but all such calls // must return before the outer test function for t returns.