Documentation
¶
Overview ¶
Package covers contains a library for programatically asserting that a line of code is covered by a test case via a machine-readable comments. See the tests for simple examples.
BE ADVISED: This package is under construction and the API may change in backwards incompatible ways and without notice.
Index ¶
Constants ¶
const TagPrefix = "//covers:"
TagPrefix is the prefix for machine-readable comments. For example "//covers:DescriptiveName"
Variables ¶
var ( ErrNoCoverage = errors.New("coverage not enabled (-cover)") ErrWrongMode = errors.New("mode not supported for operation") )
Functions ¶
This section is empty.
Types ¶
type Counters ¶
type Counters struct { Snapshot // contains filtered or unexported fields }
Counters represents a mapping of machine-readable "//covers:" tags to coverage counters.
func May ¶
May loads a Counters struct if coverage is enabled. Otherwise the struct is non-functional.
func Must ¶
Must loads a Counters struct if coverage is enabled. It will fail the test is coverage is unavailable.
func Should ¶
Should loads a Counters struct if coverage is enabled. Otherwise the struct is non-functional. It will log if coverage was not enabled via command line options.
func (*Counters) NewSnapshot ¶
NewSnapshot saves the value of coverage counters to a Snapshot.