Skip to content

Commit

Permalink
chore(denippet): modify go snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
ttak0422 committed Jan 25, 2025
1 parent 53c2a06 commit ff2a190
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions tmpl/denippet/go.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func Test$1(t *testing.T) {
prefix = ['parameterized_test', 'table_driven_test']
body = """
func Test$1(t *testing.T) {
testCases := []struct {
tests := []struct {
desc string
$2
}{
Expand All @@ -120,10 +120,39 @@ func Test$1(t *testing.T) {
},
}
for _, tC := range testCases {
t.Run(tC.desc, func(t *testing.T) {
for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
t.Parallel()
$0
})
}
}
"""

[sync_parameterized_test]
prefix = ['sync_parameterized_test', 'sync_table_driven_test']
body = """
func Test$1(t *testing.T) {
tests := []struct {
desc string
$2
}{
{
desc: "$3",
$4
},
}
for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
$0
})
}
}
"""

[append]
prefix = 'append'
body = """
$1 = append($1, $2)
"""

0 comments on commit ff2a190

Please sign in to comment.