Skip to content

Commit

Permalink
snippets: add fuzz function
Browse files Browse the repository at this point in the history
  • Loading branch information
burik666 committed Jan 25, 2024
1 parent ca6c532 commit 970a78a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gosnippets/UltiSnips/go.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,14 @@ for _, tt := range tests {
}
endsnippet

# fuzz function
snippet fuzz "func FuzzXYZ(f *testing.F) { ... }"
func Fuzz${1:Function}(f *testing.F) {
f.Fuzz(func(t *testing.T, ${2}) {
${0:${VISUAL}}
})
}
endsnippet

snippet hf "http.HandlerFunc"
func ${1:handler}(w http.ResponseWriter, r *http.Request) {
Expand Down
8 changes: 8 additions & 0 deletions gosnippets/snippets/go.snip
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@ abbr var test = {...}{...} for {t.Run(){...}}
}
})
}
# fuzz function
snippet fuzz
abbr func FuzzXYZ(f *testing.F) { ... }
func Fuzz${1:Function}(f *testing.F) {
f.Fuzz(func(t *testing.T, ${2:ff}) {
${0}
})
}
# test server
snippet tsrv
abbr ts := httptest.NewServer(...)
Expand Down

0 comments on commit 970a78a

Please sign in to comment.