Documentation
¶
Overview ¶
Package coverage analyzes Go test coverage to identify which code is tested.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
Block holds the start and end coordinates of a section of a source file covered by tests.
type Coverage ¶
type Coverage struct {
// contains filtered or unexported fields
}
Coverage is responsible for executing a Go test with coverage via the Run() method, then parsing the result coverage report file.
func New ¶
New instantiates a Coverage element using exec.CommandContext as execContext, actually running the command on the OS.
func NewWithCmd ¶
func NewWithCmd(cmdContext execContext, workdir string, mod gomodule.GoModule, opts ...Option) *Coverage
NewWithCmd instantiates a Coverage element given a custom execContext.
func (*Coverage) Run ¶
Run executes the coverage command and parses the results, returning a *Profile object. Before executing the coverage, it downloads the go modules in a separate step. This is done to avoid that the download phase impacts the execution time which is later used as timeout for the mutant testing execution. The cancellation of ctx stops the running command.
type Profile ¶
Profile is implemented as a map holding a slice of Block per each filename.
func (Profile) IsCovered ¶
IsCovered checks if the given token.Position is covered by the coverage Profile.
func (Profile) IsDirCovered ¶ added in v0.8.0
IsDirCovered tells if the tests executed a block of a file in the slash-separated directory dir. The files of one directory make one package.