1
0
mirror of https://github.com/golang/go synced 2024-11-20 03:24:41 -07:00

testing: add a method testing.CoverMode

This makes it possible to avoid tests where coverage affects the test
results by skipping them (or otherwise adjusting them) when coverage
is enabled.

Update #17699

Change-Id: Ifcc36cfcd88ebd677890e82ba80ee3d696ed3d7c
Reviewed-on: https://go-review.googlesource.com/32483
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Rob Pike 2016-11-01 11:01:39 -07:00
parent b06c93e45b
commit daf3f08264

View File

@ -283,6 +283,13 @@ func Short() bool {
return *short return *short
} }
// CoverMode reports what the test coverage mode is set to. The
// values are "set", "count", or "atomic". The return value will be
// empty if test coverage is not enabled.
func CoverMode() string {
return cover.Mode
}
// Verbose reports whether the -test.v flag is set. // Verbose reports whether the -test.v flag is set.
func Verbose() bool { func Verbose() bool {
return *chatty return *chatty