From 645cb62ee3926ce88b8c2cf556fed6dea3d525ce Mon Sep 17 00:00:00 2001 From: Julien Tant Date: Tue, 27 Apr 2021 21:32:18 +0000 Subject: [PATCH] testing: document that TestMain can be used with benchmarks Fixes #45764 Change-Id: Ie6c18bb5c20721c2ffa8b4a9cf9f97cdc665a450 GitHub-Last-Rev: 8bcea7e0ff60227c05437b372c0a3546e151af31 GitHub-Pull-Request: golang/go#45808 Reviewed-on: https://go-review.googlesource.com/c/go/+/314349 Reviewed-by: Ian Lance Taylor Trust: Bryan C. Mills --- 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 2146195956f..1562eadef08 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -208,14 +208,14 @@ // // Main // -// It is sometimes necessary for a test program to do extra setup or teardown -// before or after testing. It is also sometimes necessary for a test to control +// It is sometimes necessary for a test or benchmark program to do extra setup or teardown +// before or after it executes. It is also sometimes necessary to control // which code runs on the main thread. To support these and other cases, // if a test file contains a function: // // func TestMain(m *testing.M) // -// then the generated test will call TestMain(m) instead of running the tests +// then the generated test will call TestMain(m) instead of running the tests or benchmarks // directly. TestMain runs in the main goroutine and can do whatever setup // and teardown is necessary around a call to m.Run. m.Run will return an exit // code that may be passed to os.Exit. If TestMain returns, the test wrapper