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