Repos / gocov/smoke / bdca4c9dd9a8 / github.com/gocov/smoke/smoke.go

github.com/gocov/smoke/smoke.go

5 of 6 statements covered · commit bdca4c9dd9a8

File coverage
83.3%
2 uncovered lines in 1 block
29 lines, fully covered · expand
1
// Package smoke exists to be uploaded. After every deploy of
2
// app.gocov.dev, the deploy workflow in gocov/gocov runs this module's
3
// tests and uploads the coverage with the release's own CLI binary — a
4
// real upload over the real path, against the version that just went
5
// live.
6
//
7
// The code is shaped to make the report worth looking at: one function
8
// with branches the test covers, and one it deliberately never calls,
9
// so the coverage number is stable and strictly between 0 and 100.
10
package smoke
11
12
// Classify buckets a coverage percentage the way a human reading a badge
13
// would.
14
func Classify(percent float64) string {
15
	switch {
16
	case percent < 0 || percent > 100:
17
		return "impossible"
18
	case percent < 50:
19
		return "low"
20
	case percent < 80:
21
		return "fair"
22
	default:
23
		return "good"
24
	}
25
}
26
27
// NeverCovered is here so the uploaded report always contains uncovered
28
// lines. No test calls it, and none should.
29
func NeverCovered() string {
30
	return "if this shows up covered, something is very wrong"
31
}
Executed, with hit count Never executed Not a statement The rail maps all 31 lines of the file.