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

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

View as plain text