github.com/quay/claircore@v1.5.28/rhel/dockerfile/fuzz_test.go (about) 1 package dockerfile 2 3 import ( 4 "bytes" 5 "testing" 6 ) 7 8 func FuzzLex(f *testing.F) { 9 f.Fuzz(func(t *testing.T, b []byte) { 10 l := newLexer() 11 l.Reset(bytes.NewReader(b)) 12 for { 13 switch i := l.Next(); i.kind { 14 case itemEOF: 15 return 16 case itemError: 17 t.Fatal(i.val) 18 default: 19 t.Logf("%v:\t%s", i.kind, i.val) 20 } 21 } 22 }) 23 } 24 25 //go:generate sh -c "go run golang.org/x/tools/cmd/file2fuzz -o testdata/fuzz/FuzzLex $(ls -1 testdata/Dockerfile* | grep -v [.]want)"