Commit e6ad56c7 authored by Matt T. Proud's avatar Matt T. Proud Committed by Russ Cox

testing/quick: improve function signature error.

This commit fixes a cosmetic defect whereby quick.Check reports that
the provided function returns too many values when it may, in fact,
return too few:

  func f() {}

  func TestFoo(t *testing.T) {
    if err := quick.Check(f, nil); err != nil {
      t.Fatal(err)
    }
  }
  // yields
  // $ go test -v foo_test.go
  // === RUN TestFoo
  // --- FAIL: TestFoo (0.00s)
  // 	foo_test.go:76: function returns more than one value.

Change-Id: Ia209ff5b57375b30f8db425454e80798908e8ff4
Reviewed-on: https://go-review.googlesource.com/11281Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent fe15da62
...@@ -249,7 +249,7 @@ func Check(f interface{}, config *Config) (err error) { ...@@ -249,7 +249,7 @@ func Check(f interface{}, config *Config) (err error) {
} }
if fType.NumOut() != 1 { if fType.NumOut() != 1 {
err = SetupError("function returns more than one value.") err = SetupError("function does not return one value")
return return
} }
if fType.Out(0).Kind() != reflect.Bool { if fType.Out(0).Kind() != reflect.Bool {
......
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