Skip to content

testing: (*testing.Benchmark).Log always logs #10713

Description

@jeffallen

With this benchmark:

package main
import "testing"
func BenchmarkLog(b *testing.B) {
b.Log("why?")
}

I get this output:

$ go test -bench .
testing: warning: no tests to run
PASS
BenchmarkLog 2000000000 0.00 ns/op
--- BENCH: BenchmarkLog
issue_test.go:6: why?
issue_test.go:6: why?
issue_test.go:6: why?
issue_test.go:6: why?
issue_test.go:6: why?
issue_test.go:6: why?

The docs say, "The text will be printed only if the test fails or the -test.v flag is set."

Why is b.Log logging anyway?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions