You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
821 B
Cheetah
48 lines
821 B
Cheetah
2 years ago
|
{{ if lookPath "go" -}}
|
||
4 years ago
|
snippet ignore "ignore function" !
|
||
2 years ago
|
func(...any) {}(${1})
|
||
4 years ago
|
endsnippet
|
||
4 years ago
|
snippet ctx "context" !
|
||
|
ctx context.Context
|
||
|
endsnippet
|
||
|
snippet e "error wrapper" !
|
||
4 years ago
|
e := wrap(".${1}")
|
||
|
endsnippet
|
||
|
snippet test "setup test case" !
|
||
|
func Test${1}(t *testing.T) {
|
||
|
type testcase struct {
|
||
4 years ago
|
Name string
|
||
|
Setup func(tc *testcase)
|
||
4 years ago
|
}
|
||
|
tt := []testcase{}
|
||
|
for _, tc := range tt {
|
||
|
tc := tc
|
||
4 years ago
|
t.Run(tc.Name, func(t *testing.T) {
|
||
4 years ago
|
t.Parallel()
|
||
4 years ago
|
tc.Setup(&tc)
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
endsnippet
|
||
2 years ago
|
|
||
|
snippet htest "setup context test case" !
|
||
4 years ago
|
func Test${1}(t *testing.T) {
|
||
|
type testcase struct {
|
||
|
Name string
|
||
|
Setup func(tc *testcase)
|
||
|
}
|
||
2 years ago
|
|
||
4 years ago
|
tt := []testcase{}
|
||
2 years ago
|
|
||
4 years ago
|
for _, tc := range tt {
|
||
|
tc := tc
|
||
|
t.Run(tc.Name, func(t *testing.T) {
|
||
2 years ago
|
ctx, a, ctrl := utils.Test(t)
|
||
4 years ago
|
t.Parallel()
|
||
|
tc.Setup(&tc)
|
||
4 years ago
|
})
|
||
|
}
|
||
|
}
|
||
4 years ago
|
endsnippet
|
||
2 years ago
|
{{- end }}
|