Add a helper module for fuzzing CLI parsers
This commit is contained in:
parent
2e8040ec5e
commit
5c81aab54d
|
@ -0,0 +1,15 @@
|
|||
import
|
||||
strutils,
|
||||
stew/byteutils, testutils/fuzzing,
|
||||
../confutils
|
||||
|
||||
template fuzzCliParsing*(Conf: type) =
|
||||
test:
|
||||
block:
|
||||
try:
|
||||
let cfg = Conf.load(cmdLine = split(fromBytes(string, payload)),
|
||||
printUsage = false,
|
||||
quitOnFailure = false)
|
||||
except ConfigurationError as err:
|
||||
discard
|
||||
|
|
@ -2,6 +2,8 @@ import std/parseutils
|
|||
import stew/shims/net as stewNet
|
||||
export stewNet
|
||||
|
||||
export ValidIpAddress
|
||||
|
||||
func parseCmdArg*(T: type ValidIpAddress, s: TaintedString): T =
|
||||
ValidIpAddress.init(string s)
|
||||
|
||||
|
|
Loading…
Reference in New Issue