]> Cypherpunks repositories - gostls13.git/commitdiff
testing/quick: improve function signature error.
authorMatt T. Proud <matt.proud@gmail.com>
Sat, 20 Jun 2015 04:29:18 +0000 (06:29 +0200)
committerRuss Cox <rsc@golang.org>
Fri, 26 Jun 2015 18:03:32 +0000 (18:03 +0000)
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/11281
Reviewed-by: Russ Cox <rsc@golang.org>
src/testing/quick/quick.go

index 0e36810eb62cc9762a844a43bf1f351ef1f689e8..13c56cdf4880035d05428aa67b9f225083ac91fd 100644 (file)
@@ -249,7 +249,7 @@ func Check(f interface{}, config *Config) (err error) {
        }
 
        if fType.NumOut() != 1 {
-               err = SetupError("function returns more than one value.")
+               err = SetupError("function does not return one value")
                return
        }
        if fType.Out(0).Kind() != reflect.Bool {