Skip to content

Commit

Permalink
feat: support new coverage format of Go 1.20 (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Radamis <[email protected]>
  • Loading branch information
joschi and andrewradamis-paay authored Jun 28, 2024
1 parent 940046d commit 5a66382
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion 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+\S+\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
4 changes: 4 additions & 0 deletions parser/gotest/gotest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,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

0 comments on commit 5a66382

Please sign in to comment.