Skip to content

Instantly share code, notes, and snippets.

@lzakharov
Created March 31, 2021 08:58
Show Gist options
  • Save lzakharov/628dfc8ec0652bd389c889799d557e1c to your computer and use it in GitHub Desktop.
Save lzakharov/628dfc8ec0652bd389c889799d557e1c to your computer and use it in GitHub Desktop.
GoLand live template for the test functions.
func Test$NAME$(t *testing.T) {
type args struct {
$ARGS$
}
type want struct {
$WANT$
}
test := func(args args, want want) func(t *testing.T) {
return func(t *testing.T) {
t.Helper()
$TEST_FUNC$
}
}
$OTHER$
tests := []struct {
name string
args args
want want
}{
{$END$},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, test(tt.args, tt.want))
}
}
@lzakharov
Copy link
Author

To add this template: Preferences -> Editor -> Live Templates -> Go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment