Skip to content

Commit

Permalink
gen: make "." the default constructor regex pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
thepudds committed Jan 3, 2022
1 parent 140027f commit 6cb5a43
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gen/fzgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func FzgenMain() int {
chainFlag := flag.Bool("chain", false, "loop over the methods of an object, which requires finding a suitable constructor in the same package and which is controllable via the -ctor flag.")
parallelFlag := flag.Bool("parallel", false, "indicates an emitted chain can be run in parallel. requires -chain")
outFileFlag := flag.String("o", "autofuzz_test.go", "output file name. defaults to autofuzz_test.go or autofuzzchain_test.go")
constructorPatternFlag := flag.String("ctor", "^New", "regexp to use if searching for constructors to automatically use.")
constructorPatternFlag := flag.String("ctor", ".", "regexp to use if searching for constructors to automatically use.")

// Less commonly used:
funcPatternFlag := flag.String("func", ".", "function regex, defaults to matching all candidate functions")
Expand Down
2 changes: 1 addition & 1 deletion gen/genfuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func emitIndependentWrapper(emit emitFunc, function mod.Func, constructors []mod
if support == noSupport {
// skip this wrapper.
emit("// skipping %s because parameters include func, chan, or unsupported interface: %v\n\n", wrapperName, unsupportedParam)
return fmt.Errorf("%w: %s", errUnsupportedParams, unsupportedParam)
return fmt.Errorf("%w: %s takes %s", errUnsupportedParams, function.FuncName, unsupportedParam)
}

// Start emitting the wrapper function!
Expand Down
2 changes: 1 addition & 1 deletion gen/genfuncsloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func emitChainTarget(emit emitFunc, function mod.Func, qualifyAll bool) error {
if support == noSupport {
// we can't emit this chain target.
emit("// skipping %s because parameters include func, chan, or unsupported interface: %v\n\n", wrapperName, unsupportedParam)
return fmt.Errorf("%w: %s", errUnsupportedParams, unsupportedParam)
return fmt.Errorf("%w: %s takes %s", errUnsupportedParams, function.FuncName, unsupportedParam)
}

// Start emitting the wrapper function!
Expand Down
2 changes: 1 addition & 1 deletion testscripts/external_tailscale.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exec gotip mod tidy
exec gotip get github.com/thepudds/fzgen/fuzzer
exec gotip get -d ./...
fzgen ./...
stdout 'fzgen: created 87 files'
stdout 'fzgen: created 91 files'
exec gotip test -exec=true ./...
fzgen -chain -ctor=. ./...
stdout 'fzgen: created 23 files'
Expand Down

0 comments on commit 6cb5a43

Please sign in to comment.