testing: fix testing.B.Loop doc on loop condition

As mentioned by
https://github.com/golang/go/issues/61515#issuecomment-2656656554,
the documentation should be relaxed.

Change-Id: I9f18301e1a4e4d9a72c9fa0b1132b1ba3cc57b03
Reviewed-on: https://go-review.googlesource.com/c/go/+/651435
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Commit-Queue: Junyang Shao <shaojunyang@google.com>
This commit is contained in:
Junyang Shao 2025-02-21 16:23:36 +00:00 committed by Go LUCI
parent 0312e31ed1
commit f48b53f0f6
1 changed files with 3 additions and 3 deletions

View File

@ -426,9 +426,9 @@ func (b *B) loopSlowPath() bool {
// The compiler never optimizes away calls to functions within the body of a
// "for b.Loop() { ... }" loop. This prevents surprises that can otherwise occur
// if the compiler determines that the result of a benchmarked function is
// unused. The loop must be written in exactly this form, and this only applies
// to calls syntactically between the curly braces of the loop. Optimizations
// are performed as usual in any functions called by the loop.
// unused. The loop condition must be written in exactly as "b.Loop()", and this
// only applies to calls syntactically between the curly braces of the loop.
// Optimizations are performed as usual in any functions called by the loop.
//
// After Loop returns false, b.N contains the total number of iterations that
// ran, so the benchmark may use b.N to compute other average metrics.