Skip to content

Commit 970a78a

Browse files
committed
snippets: add fuzz function
1 parent ca6c532 commit 970a78a

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

gosnippets/UltiSnips/go.snippets

+8
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,14 @@ for _, tt := range tests {
464464
}
465465
endsnippet
466466

467+
# fuzz function
468+
snippet fuzz "func FuzzXYZ(f *testing.F) { ... }"
469+
func Fuzz${1:Function}(f *testing.F) {
470+
f.Fuzz(func(t *testing.T, ${2}) {
471+
${0:${VISUAL}}
472+
})
473+
}
474+
endsnippet
467475

468476
snippet hf "http.HandlerFunc"
469477
func ${1:handler}(w http.ResponseWriter, r *http.Request) {

gosnippets/snippets/go.snip

+8
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,14 @@ abbr var test = {...}{...} for {t.Run(){...}}
340340
}
341341
})
342342
}
343+
# fuzz function
344+
snippet fuzz
345+
abbr func FuzzXYZ(f *testing.F) { ... }
346+
func Fuzz${1:Function}(f *testing.F) {
347+
f.Fuzz(func(t *testing.T, ${2:ff}) {
348+
${0}
349+
})
350+
}
343351
# test server
344352
snippet tsrv
345353
abbr ts := httptest.NewServer(...)

0 commit comments

Comments
 (0)