Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 BuildPerTestProfile(pkgPath, modulePath, tmpDir string, timeout uint, workers int, extraTestFlags []string) (*PerTestProfile, error)
BuildPerTestProfile runs each test function in pkgPath individually with -coverprofile to build a map of which lines each test covers. It uses up to workers goroutines in parallel. Returns nil on any hard failure (the caller falls back to the full test suite).
timeout is the per-test run timeout in seconds (same value as --exec-timeout). extraTestFlags are appended before the explicit -run flag so that -short, -race, etc. are consistent between profile-building and actual mutation test runs.
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".