5 of 6 statements covered · commit bdca4c9dd9a8
// Package smoke exists to be uploaded. After every deploy of
// app.gocov.dev, the deploy workflow in gocov/gocov runs this module's
// tests and uploads the coverage with the release's own CLI binary — a
// real upload over the real path, against the version that just went
// live.
//
// The code is shaped to make the report worth looking at: one function
// with branches the test covers, and one it deliberately never calls,
// so the coverage number is stable and strictly between 0 and 100.
package smoke
// Classify buckets a coverage percentage the way a human reading a badge
// would.
func Classify(percent float64) string { switch {case percent < 0 || percent > 100:
return "impossible"
case percent < 50:
return "low"
case percent < 80:
return "fair"
default:
return "good"
}
}
// NeverCovered is here so the uploaded report always contains uncovered
// lines. No test calls it, and none should.
func NeverCovered() string {return "if this shows up covered, something is very wrong"
}