Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 2 additions & 1 deletion pkg/testcoverage/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ func reportUncoveredLines(w io.Writer, result AnalyzeResult) {
defer tabber.Flush()

fmt.Fprintf(tabber, "\nFiles with uncovered lines:")
fmt.Fprintf(tabber, "\n file:\tuncovered lines:")
fmt.Fprintf(tabber, "\n file:\tfile coverage:\tuncovered lines:")

for _, stats := range result.FilesWithUncoveredLines {
if len(stats.UncoveredLines) > 0 {
fmt.Fprintf(tabber, "\n %s\t", stats.Name)
fmt.Fprintf(tabber, "%v%%\t", stats.CoveredPercentageF())
compressUncoveredLines(tabber, stats.UncoveredLines)
}
}
Expand Down
6 changes: 4 additions & 2 deletions pkg/testcoverage/report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,13 @@ func Test_ReportUncoveredLines(t *testing.T) {
FilesWithUncoveredLines: []coverage.Stats{
{Name: "a.go", UncoveredLines: []int{1, 2, 3}},
{Name: "b.go", UncoveredLines: []int{3, 5, 7}},
{Name: "c.go", UncoveredLines: []int{1, 4, 10}, Covered: 20, Total: 100},
},
})
assertHasUncoveredLinesInfo(t, buf.String(), []string{
"a.go\t\t1-3\n",
"b.go\t\t3 5 7\n",
"a.go\t\t0%\t\t1-3\n",
"b.go\t\t0%\t\t3 5 7\n",
"c.go\t\t20%\t\t1 4 10\n",
})

// when result passes, there should be no output
Expand Down
Loading