diff options
| author | Matt T. Proud <matt.proud@gmail.com> | 2015-10-29 11:14:05 +0100 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-02-26 20:04:04 +0000 |
| commit | 0ccabe2e0b42a2602e0f37ce28d5368aa811f530 (patch) | |
| tree | 58383052537513a7d1caa66259e6fc665267bf02 /src/testing/quick/quick_test.go | |
| parent | 763e8fcc8931b44db77f7bcbc7b6943a2a8fb747 (diff) | |
| download | go-0ccabe2e0b42a2602e0f37ce28d5368aa811f530.tar.xz | |
testing/quick: generate more map and slice states
This change adds support in testing/quick to generate maps and slices
in additional states:
(1.) nil maps
(2.) nil slices
(3.) empty slice occupancy: `len(s) == 0 && s != nil`
(4.) partial slice occupancy: `len(s) < cap(s) && s != nil`
(5.) full slice occupancy: `len(s) == cap(s) && s != nil`
Prior to this, only #5 was ever generated, thereby not sufficiently
exercising all of the fuzzable code path outcomes.
This change depends on https://go-review.googlesource.com/#/c/17499/.
Change-Id: I9343c475cefbd72ffc5237281826465c25872206
Reviewed-on: https://go-review.googlesource.com/16470
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/testing/quick/quick_test.go')
| -rw-r--r-- | src/testing/quick/quick_test.go | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/src/testing/quick/quick_test.go b/src/testing/quick/quick_test.go index fe443592f8..018ece2a52 100644 --- a/src/testing/quick/quick_test.go +++ b/src/testing/quick/quick_test.go @@ -290,20 +290,3 @@ func TestMutuallyRecursive(t *testing.T) { f := func(a A) bool { return true } Check(f, nil) } - -// Some serialization formats (e.g. encoding/pem) cannot distinguish -// between a nil and an empty map or slice, so avoid generating the -// zero value for these. -func TestNonZeroSliceAndMap(t *testing.T) { - type Q struct { - M map[int]int - S []int - } - f := func(q Q) bool { - return q.M != nil && q.S != nil - } - err := Check(f, nil) - if err != nil { - t.Fatal(err) - } -} |
