Skip to content

Commit daf3f08

Browse files
committed
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>
1 parent b06c93e commit daf3f08

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/testing/testing.go

+7
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,13 @@ func Short() bool {
283283
return *short
284284
}
285285

286+
// CoverMode reports what the test coverage mode is set to. The
287+
// values are "set", "count", or "atomic". The return value will be
288+
// empty if test coverage is not enabled.
289+
func CoverMode() string {
290+
return cover.Mode
291+
}
292+
286293
// Verbose reports whether the -test.v flag is set.
287294
func Verbose() bool {
288295
return *chatty

0 commit comments

Comments
 (0)