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?
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?