aboutsummaryrefslogtreecommitdiff
path: root/src/testing/loop_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/loop_test.go')
-rw-r--r--src/testing/loop_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/testing/loop_test.go b/src/testing/loop_test.go
index ae1a5e019b..7a1a93fcee 100644
--- a/src/testing/loop_test.go
+++ b/src/testing/loop_test.go
@@ -8,6 +8,7 @@ func TestBenchmarkBLoop(t *T) {
var initialStart highPrecisionTime
var firstStart highPrecisionTime
var lastStart highPrecisionTime
+ var runningEnd bool
runs := 0
iters := 0
finalBN := 0
@@ -22,6 +23,7 @@ func TestBenchmarkBLoop(t *T) {
iters++
}
finalBN = b.N
+ runningEnd = b.timerOn
})
// Verify that a b.Loop benchmark is invoked just once.
if runs != 1 {
@@ -46,6 +48,10 @@ func TestBenchmarkBLoop(t *T) {
if lastStart != firstStart {
t.Errorf("timer was reset during iteration")
}
+ // Verify that it stopped the timer after the last loop.
+ if runningEnd {
+ t.Errorf("timer was still running after last iteration")
+ }
}
// See also TestBenchmarkBLoop* in other files.