(f *testing.F)
| 12 | ) |
| 13 | |
| 14 | func FuzzParseConfig(f *testing.F) { |
| 15 | f.Fuzz(func(t *testing.T, data []byte) { |
| 16 | file, diags := hclwrite.ParseConfig(data, "<fuzz-conf>", hcl.Pos{Line: 1, Column: 1}) |
| 17 | |
| 18 | if diags.HasErrors() { |
| 19 | t.Logf("Error when parsing JSON %v", data) |
| 20 | for _, diag := range diags { |
| 21 | t.Logf("- %s", diag.Error()) |
| 22 | } |
| 23 | return |
| 24 | } |
| 25 | |
| 26 | _, err := file.WriteTo(io.Discard) |
| 27 | |
| 28 | if err != nil { |
| 29 | t.Fatalf("error writing to file: %s", err) |
| 30 | } |
| 31 | }) |
| 32 | } |
nothing calls this directly
no test coverage detected