MCPcopy
hub / github.com/hashicorp/hcl / FuzzParseConfig

Function FuzzParseConfig

hclwrite/fuzz/fuzz_test.go:14–32  ·  view source on GitHub ↗
(f *testing.F)

Source from the content-addressed store, hash-verified

12)
13
14func 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}

Callers

nothing calls this directly

Calls 4

ParseConfigFunction · 0.92
HasErrorsMethod · 0.80
ErrorMethod · 0.45
WriteToMethod · 0.45

Tested by

no test coverage detected