From 3c1f73d53efbd53bc97dd40bc848c0b33be3acc2 Mon Sep 17 00:00:00 2001 From: Florian Polster Date: Thu, 10 Sep 2020 16:31:32 +0200 Subject: [PATCH] Add snippet for TestMain --- snippets/go.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/go.json b/snippets/go.json index 301ead3046..a96411a7a7 100644 --- a/snippets/go.json +++ b/snippets/go.json @@ -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}",