aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2016-11-01 11:01:39 -0700
committerRob Pike <r@golang.org>2016-11-01 18:12:04 +0000
commitdaf3f082648274b0da7264bcc4794ca0dd4b999d (patch)
tree9c9c03e101a474aa62cf4703dd7f6ffb1d3c8592 /src/testing
parentb06c93e45b7b03a5d670250ff35e42d62aface82 (diff)
downloadgo-daf3f082648274b0da7264bcc4794ca0dd4b999d.tar.xz
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>
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing.go7
1 files changed, 7 insertions, 0 deletions
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