Standard library / testing

testing.InternalBenchmark

Descriptor used by generated test harnesses, not ordinary benchmark authoring. The example inspects a callback without running a generated harness. Expected stdout: 'BenchmarkDemo true\n'.

Formal Syntax & Structure

go syntaxgo
type InternalBenchmark struct {  Name string  F    func(b *B)}

Working Example

Example Snippetgo
package main
import (  "fmt"  "testing")
func main() {  d := testing.InternalBenchmark{Name: "BenchmarkDemo", F: func(b *testing.B) {}}  fmt.Println(d.Name, d.F != nil)}
Go Reference