]> Cypherpunks repositories - gostls13.git/commitdiff
testing: add a method testing.CoverMode
authorRob Pike <r@golang.org>
Tue, 1 Nov 2016 18:01:39 +0000 (11:01 -0700)
committerRob Pike <r@golang.org>
Tue, 1 Nov 2016 18:12:04 +0000 (18:12 +0000)
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>
src/testing/testing.go

index ce5b85236418c93a25114e95f78c920291a1a4b1..c52884f0f4a9ecaee8b2c134f1fa04c0e5e22ba1 100644 (file)
@@ -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