Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountTests ¶ added in v2.6.6
CountTests returns the number of test functions (Test*, Benchmark*, Fuzz*) in pkgPath. Returns 0 on any error or when the package has no tests.
Types ¶
type PerTestProfile ¶ added in v2.6.2
type PerTestProfile struct {
// contains filtered or unexported fields
}
PerTestProfile maps each (module-relative file path, line) to the sorted list of test function names that cover it. Callers look up by absolute file path using CoveringTests; the match is done via suffix so it survives GOPATH/module root variations.
func BuildPerTestProfile ¶ added in v2.6.2
func (*PerTestProfile) CoveringTests ¶ added in v2.6.2
func (p *PerTestProfile) CoveringTests(absFile string, lineNum int) []string
CoveringTests returns the sorted test names that cover absFile at lineNum. Returns nil when the line is not covered by any individually-run test.
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile holds which source lines are covered by tests.
func ParseProfile ¶
ParseProfile parses a Go coverage profile (generated by go test -coverprofile) using modulePath to strip the module prefix from each entry, leaving relative paths that can be matched against absolute file paths.
Example: with modulePath="github.com/acme/app", the profile entry "github.com/acme/app/pkg/foo.go:5.1,10.3 2 1" becomes key "pkg/foo.go".