Commit 3f1cff39 authored by Rob Pike's avatar Rob Pike

testing/quick: documentation tweaks

Fixes #2960.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5652055
parent 1308f7c9
...@@ -50,7 +50,7 @@ const complexSize = 50 ...@@ -50,7 +50,7 @@ const complexSize = 50
// Value returns an arbitrary value of the given type. // Value returns an arbitrary value of the given type.
// If the type implements the Generator interface, that will be used. // If the type implements the Generator interface, that will be used.
// Note: in order to create arbitrary values for structs, all the members must be public. // Note: To create arbitrary values for structs, all the fields must be exported.
func Value(t reflect.Type, rand *rand.Rand) (value reflect.Value, ok bool) { func Value(t reflect.Type, rand *rand.Rand) (value reflect.Value, ok bool) {
if m, ok := reflect.Zero(t).Interface().(Generator); ok { if m, ok := reflect.Zero(t).Interface().(Generator); ok {
return m.Generate(rand, complexSize), true return m.Generate(rand, complexSize), true
...@@ -155,9 +155,10 @@ type Config struct { ...@@ -155,9 +155,10 @@ type Config struct {
// If non-nil, rand is a source of random numbers. Otherwise a default // If non-nil, rand is a source of random numbers. Otherwise a default
// pseudo-random source will be used. // pseudo-random source will be used.
Rand *rand.Rand Rand *rand.Rand
// If non-nil, Values is a function which generates a slice of arbitrary // If non-nil, the Values function generates a slice of arbitrary
// Values that are congruent with the arguments to the function being // reflect.Values that are congruent with the arguments to the function
// tested. Otherwise, Values is used to generate the values. // being tested. Otherwise, the top-level Values function is used
// to generate them.
Values func([]reflect.Value, *rand.Rand) Values func([]reflect.Value, *rand.Rand)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment