1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
package fuzzjson import ( "testing" "github.com/hashicorp/hcl/v2/json" ) func FuzzParse(f *testing.F) { f.Fuzz(func(t *testing.T, data []byte) { _, diags := json.Parse(data, "<fuzz-conf>") if diags.HasErrors() { t.Logf("Error when parsing JSON %v", data) for _, diag := range diags { t.Logf("- %s", diag.Error()) } } }) }