forked from sguiheux/go-coverage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoverage_test.go
46 lines (37 loc) · 1.24 KB
/
coverage_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package coverage
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestLCOV(t *testing.T) {
lcovParser := New(LCOV)
report, err := lcovParser.Parse("./test/lcov.info")
assert.NoError(t, err)
assert.Equal(t, 67, report.CoveredBranches)
assert.Equal(t, 1757, report.TotalBranches)
assert.Equal(t, 412, report.CoveredFunctions)
assert.Equal(t, 1695, report.TotalFunctions)
assert.Equal(t, 2798, report.CoveredLines)
assert.Equal(t, 6395, report.TotalLines)
assert.Equal(t, 182, len(report.Files))
}
func TestCobertura(t *testing.T) {
coberturaParser := New(COBERTURA)
report, err := coberturaParser.Parse("./test/coverage.xml")
assert.NoError(t, err)
assert.Equal(t, 8, report.TotalLines)
assert.Equal(t, 6, report.CoveredLines)
assert.Equal(t, 4, report.TotalBranches)
assert.Equal(t, 2, report.CoveredBranches)
}
func TestClover(t *testing.T) {
cloverParser := New(CLOVER)
report, err := cloverParser.Parse("./test/clover.xml")
assert.NoError(t, err)
assert.Equal(t, 20672, report.TotalLines)
assert.Equal(t, 5337, report.CoveredLines)
assert.Equal(t, 12764, report.TotalBranches)
assert.Equal(t, 1123, report.CoveredBranches)
assert.Equal(t, 2485, report.TotalFunctions)
assert.Equal(t, 1282, report.CoveredFunctions)
}