From: Rob Pike Date: Tue, 1 Nov 2016 18:01:39 +0000 (-0700) Subject: testing: add a method testing.CoverMode X-Git-Tag: go1.8beta1~404 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=daf3f082648274b0da7264bcc4794ca0dd4b999d;p=gostls13.git 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 --- diff --git a/src/testing/testing.go b/src/testing/testing.go index ce5b852364..c52884f0f4 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -283,6 +283,13 @@ func Short() bool { 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. func Verbose() bool { return *chatty