From 0f1caf6c3e641dd0b899d96b9f28007aa3f4924a Mon Sep 17 00:00:00 2001 From: Ingmar Stein Date: Tue, 25 Jul 2017 09:25:47 +0200 Subject: [PATCH] Revert changes to coverage regexps Add expected test output instead --- go-junit-report_test.go | 8 ++++++-- parser/parser.go | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/go-junit-report_test.go b/go-junit-report_test.go index bbac68d..9e71c11 100644 --- a/go-junit-report_test.go +++ b/go-junit-report_test.go @@ -312,7 +312,9 @@ var testCases = []TestCase{ Name: "TestB", Time: 300, Result: parser.PASS, - Output: []string{}, + Output: []string{ + "coverage: 10% of statements", + }, }, }, CoveragePct: "10.0", @@ -722,7 +724,9 @@ var testCases = []TestCase{ Name: "TestB", Time: 300, Result: parser.PASS, - Output: []string{}, + Output: []string{ + "coverage: 10% of statements in fmt, encoding/xml", + }, }, }, CoveragePct: "10.0", diff --git a/parser/parser.go b/parser/parser.go index 50dcac5..9d05c05 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -41,8 +41,8 @@ type Test struct { var ( regexStatus = regexp.MustCompile(`^\s*--- (PASS|FAIL|SKIP): (.+) \((\d+\.\d+)(?: seconds|s)\)$`) - regexCoverage = regexp.MustCompile(`^coverage:\s+(\d+(?:\.\d+)?)%\s+of\s+statements(?:\sin\s.+)?$`) - regexResult = regexp.MustCompile(`^(ok|FAIL)\s+([^ ]+)\s+(?:(\d+\.\d+)s|(\[\w+ failed]))(?:\s+coverage:\s+(\d+(?:\.\d+))%\sof\sstatements(?:\sin\s.+)?)?$`) + regexCoverage = regexp.MustCompile(`^coverage:\s+(\d+\.\d+)%\s+of\s+statements(?:\sin\s.+)?$`) + regexResult = regexp.MustCompile(`^(ok|FAIL)\s+([^ ]+)\s+(?:(\d+\.\d+)s|(\[\w+ failed]))(?:\s+coverage:\s+(\d+\.\d+)%\sof\sstatements(?:\sin\s.+)?)?$`) regexOutput = regexp.MustCompile(`( )*\t(.*)`) regexSummary = regexp.MustCompile(`^(PASS|FAIL|SKIP)$`) )