aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2024-12-17 15:31:10 -0800
committerDavid Chase <drchase@google.com>2024-12-18 08:18:04 -0800
commit971448ddf8c55a5f4a829735a5a96cacf982f230 (patch)
treee1a5dc1217e242b39c50a8a25d9ca7ba4fd98d50 /src/testing/testing.go
parent95b433eed428afbb4ab32f0f2541774e939989c7 (diff)
downloadgo-971448ddf8c55a5f4a829735a5a96cacf982f230.tar.xz
testing: support B.Context and F.Context
CL 603959 added T.Context for #36532. The discussion on the proposal only mentions t.Context. However, the implementation of CL 603959 also added B.Context and F.Context. They were added to the API listing, and B.Context was mentioned in the release notes. Unfortunately, the new B.Context and F.Context methods always returned nil, rather than a context.Context value. This change adds a working implementation of B.Context and F.Context. For #36532 Fixes #70866 Change-Id: I8a44e6649fb658e4f641ffb7efd08b4374f578ef Reviewed-on: https://go-review.googlesource.com/c/go/+/637236 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/testing/testing.go')
-rw-r--r--src/testing/testing.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index 8b4bdfbc39..be6391b0ab 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -1385,10 +1385,10 @@ func (c *common) Chdir(dir string) {
}
// Context returns a context that is canceled just before
-// [T.Cleanup]-registered functions are called.
+// Cleanup-registered functions are called.
//
// Cleanup functions can wait for any resources
-// that shut down on Context.Done before the test completes.
+// that shut down on Context.Done before the test or benchmark completes.
func (c *common) Context() context.Context {
c.checkFuzzFn("Context")
return c.ctx