Standard library / testing

testing.F.Name()

Return the full name of the current benchmark or fuzz test, including hierarchy where applicable. Expected process exit: 0; output contains ['PASS', 'name FuzzReference']. Run as a _test.go file using the Go test harness.

Formal Syntax & Structure

go syntaxgo
func (c *F) Name() string

Return Value

string

Result of the operation described above.

Working Example

Example Snippetgo
package main
import (  "fmt"  "testing")
func FuzzReference(f *testing.F) {  fmt.Println("name", f.Name())  f.Add("demo")  f.Fuzz(func(t *testing.T, s string) {    if s != "demo" {      t.Fatal(s)    }  })}
Go Reference