awl/cli/dig_test.go
Sam Therapy eda2e5b55f
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
More work!
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-07-22 23:22:43 +02:00

51 lines
1 KiB
Go

// SPDX-License-Identifier: BSD-3-Clause
package cli_test
import (
"testing"
"git.froth.zone/sam/awl/cli"
"git.froth.zone/sam/awl/util"
"gotest.tools/v3/assert"
)
func FuzzDig(f *testing.F) {
f.Log("ParseDig Fuzzing")
seeds := []string{
"aaflag", "aaonly", "noaaflag", "noaaonly",
"adflag", "noadflag",
"cdflag", "nocdflag",
"qrflag", "noqrflag",
"raflag", "noraflag",
"rdflag", "recurse", "nordflag", "norecurse",
"tcflag", "notcflag",
"zflag", "nozflag",
"dnssec", "nodnssec",
"tcp", "vc", "notcp", "novc",
"ignore", "noignore",
"short", "noshort",
"json", "nojson",
"xml", "noxml",
"yaml", "noyaml",
"question", "noquestion",
"answer", "noanswer",
"authority", "noauthority",
"additional", "noadditional",
"stats", "nostats",
"all", "noall",
"invalid",
}
for _, tc := range seeds {
f.Add(tc)
}
f.Fuzz(func(t *testing.T, orig string) {
opts := new(cli.Options)
opts.Logger = util.InitLogger(0)
err := cli.ParseDig(orig, opts)
if err != nil {
assert.ErrorContains(t, err, "unknown flag")
}
})
}