Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions parser/gotest/gotest.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var (
// regexBenchInfo captures 3-5 groups: benchmark name, number of times ran, ns/op (with or without decimal), MB/sec (optional), B/op (optional), and allocs/op (optional).
regexBenchmark = regexp.MustCompile(`^(Benchmark[^ -]+)$`)
regexBenchSummary = regexp.MustCompile(`^(Benchmark[^ -]+)(?:-\d+\s+|\s+)(\d+)\s+(\d+|\d+\.\d+)\sns\/op(?:\s+(\d+|\d+\.\d+)\sMB\/s)?(?:\s+(\d+)\sB\/op)?(?:\s+(\d+)\sallocs/op)?`)
regexCoverage = regexp.MustCompile(`^coverage:\s+(\d+|\d+\.\d+)%\s+of\s+statements(?:\sin\s(.+))?$`)
regexCoverage = regexp.MustCompile(`^(\s+[^ \t]+\s+)?coverage:\s+(\d+|\d+\.\d+)%\s+of\s+statements(?:\sin\s(.+))?$`)
regexEndBenchmark = regexp.MustCompile(`^--- (BENCH|FAIL|SKIP): (Benchmark[^ -]+)(?:-\d+)?$`)
regexEndTest = regexp.MustCompile(`((?: )*)--- (PASS|FAIL|SKIP): ([^ ]+) \((\d+\.\d+)(?: seconds|s)\)`)
regexStatus = regexp.MustCompile(`^(PASS|FAIL|SKIP)$`)
Expand Down Expand Up @@ -197,8 +197,8 @@ func (p *Parser) parseLine(line string) (events []Event) {
return p.status(matches[1])
} else if matches := regexSummary.FindStringSubmatch(line); len(matches) == 8 {
return p.summary(matches[1], matches[2], matches[3], matches[4], matches[7], matches[5], matches[6])
} else if matches := regexCoverage.FindStringSubmatch(line); len(matches) == 3 {
return p.coverage(matches[1], matches[2])
} else if matches := regexCoverage.FindStringSubmatch(line); len(matches) == 4 {
return p.coverage(matches[2], matches[3])
} else if matches := regexBenchmark.FindStringSubmatch(line); len(matches) == 2 {
return p.runBench(matches[1])
} else if matches := regexBenchSummary.FindStringSubmatch(line); len(matches) == 7 {
Expand Down
4 changes: 4 additions & 0 deletions parser/gotest/gotest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ var parseLineTests = []parseLineTest{
"coverage: 99.8% of statements in fmt, encoding/xml",
[]Event{{Type: "coverage", CovPct: 99.8, CovPackages: []string{"fmt", "encoding/xml"}}},
},
{
" package/name coverage: 13.37% of statements",
[]Event{{Type: "coverage", CovPct: 13.37}},
},
{
"BenchmarkOK",
[]Event{{Type: "run_benchmark", Name: "BenchmarkOK"}},
Expand Down