Hello,

In a Go benchmark I use b.Run() to define a number of sub-benchmarks.  This 
seems to work:

> go test -run=^$ -bench '^BenchmarkTextLayout'
goos: darwin
goarch: arm64
pkg: seehuhn.de/go/pdf/graphics
BenchmarkTextLayout/CFFSimple1-8               49   24061184 ns/op
BenchmarkTextLayout/CFFSimple2-8               48   24036174 ns/op
BenchmarkTextLayout/OpenTypeCFFSimple1-8       49   24045372 ns/op
BenchmarkTextLayout/OpenTypeCFFSimple2-8       48   24147282 ns/op
BenchmarkTextLayout/TrueTypeSimple-8           51   23030744 ns/op
BenchmarkTextLayout/OpenTypeGlyfSimple-8       51   22865664 ns/op
BenchmarkTextLayout/BuiltIn-8                   43   27654625 ns/op
...

Now I just want to run one of these sub-benchmarks.  I tried -bench 
'^BenchmarkTextLayout/CFFSimple1$' but this runs two of the benchmarks:

> go test -run=^$ -bench '^BenchmarkTextLayout/CFFSimple1$'
goos: darwin
goarch: arm64
pkg: seehuhn.de/go/pdf/graphics
BenchmarkTextLayout/CFFSimple1-8               49   24198452 ns/op
BenchmarkTextLayout/OpenTypeCFFSimple1-8       48   24209569 ns/op
PASS
ok   seehuhn.de/go/pdf/graphics 3.804s

How do I just run "BenchmarkTextLayout/CFFSimple1"?

The full code is here: 
https://github.com/seehuhn/go-pdf/blob/68fdeb74aeb39d74f9c0db6dd4117c775b0f251c/graphics/layoutext_test.go#L144

Many thanks,
Jochen

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/88319fc8-25a9-4079-8089-f9700d8b67d7n%40googlegroups.com.

Reply via email to