Skip to content

Commit

Permalink
snippets: add snippet for TestMain
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pofl authored and suzmue committed Nov 19, 2020
1 parent bf1225f commit 455e1a9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions snippets/go.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@
"body": "func Test$1(t *testing.T) {\n\t$0\n}",
"description": "Snippet for Test function"
},
"test main": {
"prefix": "tm",
"body": "func TestMain(m *testing.M) {\n\t$1\n\n\tos.Exit(m.Run())\n}",
"description": "Snippet for TestMain function"
},
"benchmark function": {
"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}",
Expand Down

0 comments on commit 455e1a9

Please sign in to comment.