Created
March 31, 2021 08:58
-
-
Save lzakharov/628dfc8ec0652bd389c889799d557e1c to your computer and use it in GitHub Desktop.
GoLand live template for the test functions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To add this template:
Preferences -> Editor -> Live Templates -> Go
.