Skip to content

Commit 455e1a9

Browse files
poflsuzmue
authored andcommitted
snippets: add snippet for TestMain
This is a natural extension of the existing test/benchmark functions snippets (tf, bf). Update #160 Change-Id: I9e787dea7fbcc063b1d1a13dffee6b09905120fe GitHub-Last-Rev: 3c1f73d GitHub-Pull-Request: #629 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/254497 Reviewed-by: Hyang-Ah Hana Kim <[email protected]> Trust: Hyang-Ah Hana Kim <[email protected]> Trust: Suzy Mueller <[email protected]>
1 parent bf1225f commit 455e1a9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

snippets/go.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@
215215
"body": "func Test$1(t *testing.T) {\n\t$0\n}",
216216
"description": "Snippet for Test function"
217217
},
218+
"test main": {
219+
"prefix": "tm",
220+
"body": "func TestMain(m *testing.M) {\n\t$1\n\n\tos.Exit(m.Run())\n}",
221+
"description": "Snippet for TestMain function"
222+
},
218223
"benchmark function": {
219224
"prefix": "bf",
220225
"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}",

0 commit comments

Comments
 (0)