Skip to content

Commit

Permalink
Merge pull request #3636 from burik666/snippets-fuzz
Browse files Browse the repository at this point in the history
snippets: add fuzz function
  • Loading branch information
bhcleek committed Jan 29, 2024
2 parents ca6c532 + 970a78a commit 535355d
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 535355d

Please sign in to comment.