aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorKatie Hockman <katie@golang.org>2021-10-05 13:05:09 -0400
committerKatie Hockman <katie@golang.org>2021-10-05 20:15:01 +0000
commit0b4d4998d57936cf8bb2566f5f3e36eb70892ca4 (patch)
tree9cd65f528e1a226afee858767d3fd0bd982c46d2 /src/testing
parent7ae83c8f38bc79e999a8657da443d815036c7d72 (diff)
downloadgo-0b4d4998d57936cf8bb2566f5f3e36eb70892ca4.tar.xz
testing: document f.Fuzz requirement to not change underlying data
Updates #48606 Change-Id: I6d555fdefccd842fb65ec8d630b4808bcb54a825 Reviewed-on: https://go-review.googlesource.com/c/go/+/353977 Trust: Katie Hockman <katie@golang.org> Run-TryBot: Katie Hockman <katie@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/fuzz.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/testing/fuzz.go b/src/testing/fuzz.go
index 771917b069..60e2603da9 100644
--- a/src/testing/fuzz.go
+++ b/src/testing/fuzz.go
@@ -299,11 +299,12 @@ var supportedTypes = map[reflect.Type]bool{
// This function sould be fast and deterministic, and its behavior should not
// depend on shared state. No mutatable input arguments, or pointers to them,
// should be retained between executions of the fuzz function, as the memory
-// backing them may be mutated during a subsequent invocation.
+// backing them may be mutated during a subsequent invocation. ff must not
+// modify the underlying data of the arguments provided by the fuzzing engine.
//
-// When fuzzing, F.Fuzz does not return until a problem is found, time runs
-// out (set with -fuzztime), or the test process is interrupted by a signal.
-// F.Fuzz should be called exactly once unless F.Skip or F.Fail is called.
+// When fuzzing, F.Fuzz does not return until a problem is found, time runs out
+// (set with -fuzztime), or the test process is interrupted by a signal. F.Fuzz
+// should be called exactly once, unless F.Skip or F.Fail is called beforehand.
func (f *F) Fuzz(ff interface{}) {
if f.fuzzCalled {
panic("testing: F.Fuzz called more than once")