github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/utils/json/unmarshal_fuzz_test.go (about) 1 //go:build go1.18 2 // +build go1.18 3 4 package json 5 6 import ( 7 "testing" 8 9 "github.com/lmorg/murex/test/count" 10 ) 11 12 func FuzzParser(f *testing.F) { 13 tests := []string{``, "[\n 1,\n 2,\n 3\n]", `{ "key: "#value" }`, `{ "key": ({ value }) }`} 14 for _, tc := range tests { 15 f.Add(tc) // Use f.Add to provide a seed corpus 16 } 17 f.Fuzz(func(t *testing.T, data string) { 18 count.Tests(t, 1) 19 unmarshalMurex([]byte(data), nil) 20 // we are just testing we can't cause an unhandled panic 21 }) 22 }