Skip to content

Commit

Permalink
Add snippet for table tests (golang#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
slomek authored and ramya-rao-a committed May 2, 2017
1 parent b5806dd commit 936fc14
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions snippets/go.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@
"prefix": "bf",
"body": "func Benchmark$1(b *testing.B) {\n\tfor ${2:i} := 0; ${2:i} < b.N; ${2:i}++ {\n\t\t$0\n\t}\n}"
},
"table driven test": {
"prefix": "tdt",
"body": "func Test$0(t *testing.T) {\n\ttestCases := []struct {\n\t\tdesc\tstring\n\t\t$1\n\t}{\n\t\t{\n\t\t\tdesc: \"$2\",\n\t\t\t$3\n\t\t},\n\t}\n\tfor _, tC := range testCases {\n\t\tt.Run(tC.desc, func(t *testing.T) {\n\t\t\t$4\n\t\t})\n\t}\n}"
},
"init function": {
"prefix": "finit",
"body": "func init() {\n\t$1\n}"
Expand Down

0 comments on commit 936fc14

Please sign in to comment.