From f7ae0905a2ea33a5e139eec6300597418c4bc3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Stemmer?= Date: Mon, 7 Oct 2019 00:24:01 +0100 Subject: [PATCH] gtr: Add support for pause/continue tests --- pkg/gtr/builder.go | 8 ++++++++ pkg/gtr/gtr.go | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/pkg/gtr/builder.go b/pkg/gtr/builder.go index cda1811..a083ad8 100644 --- a/pkg/gtr/builder.go +++ b/pkg/gtr/builder.go @@ -58,6 +58,14 @@ func (b *ReportBuilder) CreateTest(name string) { b.tests[b.newId()] = Test{Name: name} } +func (b *ReportBuilder) PauseTest(name string) { + b.lastId = 0 +} + +func (b *ReportBuilder) ContinueTest(name string) { + b.lastId = b.findTest(name) +} + func (b *ReportBuilder) EndTest(name, result string, duration time.Duration) { id := b.findTest(name) b.lastId = id diff --git a/pkg/gtr/gtr.go b/pkg/gtr/gtr.go index 2c9ae60..19f75e4 100644 --- a/pkg/gtr/gtr.go +++ b/pkg/gtr/gtr.go @@ -76,6 +76,10 @@ func FromEvents(events []Event, packageName string) Report { switch ev.Type { case "run_test": report.CreateTest(ev.Name) + case "pause_test": + report.PauseTest(ev.Name) + case "cont_test": + report.ContinueTest(ev.Name) case "end_test": report.EndTest(ev.Name, ev.Result, ev.Duration) case "benchmark":