diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-09-26 18:09:03 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-09-28 09:41:25 +0200 |
| commit | 2111afe851ac1e0302bec299eceec60f7dd0c8b7 (patch) | |
| tree | 7077cd10712f75b887fe22c032c0000fcc608f9d /pkg | |
| parent | f9bcf3095b646003bd2ec001cb93ba17192ad674 (diff) | |
pkg/cover: test that CSV profile contains main function
The test also passed if there is no main at all.
Follow up to #2074
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/cover/report_test.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pkg/cover/report_test.go b/pkg/cover/report_test.go index 54eb44937..caafa2d39 100644 --- a/pkg/cover/report_test.go +++ b/pkg/cover/report_test.go @@ -201,9 +201,16 @@ func checkCSVReport(t *testing.T, CSVReport []byte) { t.Fatalf("heading line in CSV doesn't match %v", lines[0]) } + foundMain := false for _, line := range lines { - if line[1] == "main" && line[2] != "1" && line[3] != "1" { - t.Fatalf("function coverage percentage doesn't match %v vs. %v", line[2], "100") + if line[1] == "main" { + foundMain = true + if line[2] != "1" && line[3] != "1" { + t.Fatalf("function coverage percentage doesn't match %v vs. %v", line[2], "100") + } } } + if !foundMain { + t.Fatalf("no main in the CSV report") + } } |
