...

Text file src/cmd/go/testdata/script/test_fuzz_match.txt

Documentation: cmd/go/testdata/script

     1[!fuzz] skip
     2[short] skip
     3env GOCACHE=$WORK/cache
     4
     5# Matches only fuzz targets to test.
     6go test standalone_fuzz_test.go
     7! stdout '^ok.*\[no tests to run\]'
     8stdout '^ok'
     9
    10# Matches only for fuzzing.
    11go test -fuzz Fuzz -fuzztime 1x standalone_fuzz_test.go
    12! stdout '^ok.*\[no tests to run\]'
    13stdout '^ok'
    14
    15# Matches none for fuzzing but will run the fuzz target as a test.
    16go test -fuzz ThisWillNotMatch -fuzztime 1x standalone_fuzz_test.go
    17! stdout '^ok.*no tests to run'
    18stdout '^ok'
    19stdout 'no fuzz tests to fuzz'
    20
    21[short] stop
    22
    23# Matches only fuzz targets to test with -run.
    24go test -run Fuzz standalone_fuzz_test.go
    25! stdout '^ok.*\[no tests to run\]'
    26stdout '^ok'
    27
    28# Matches no fuzz targets.
    29go test -run ThisWillNotMatch standalone_fuzz_test.go
    30stdout '^ok.*no tests to run'
    31! stdout 'no fuzz tests to fuzz'
    32
    33-- standalone_fuzz_test.go --
    34package standalone_fuzz
    35
    36import "testing"
    37
    38func Fuzz(f *testing.F) {
    39	f.Fuzz(func (*testing.T, []byte) {})
    40}

View as plain text