diff --git a/Gopkg.lock b/Gopkg.lock index 0b439ef00..a6186d3c9 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -149,7 +149,7 @@ branch = "master" name = "github.com/petergtz/pegomock" packages = [".","internal/verify"] - revision = "53d177bf13d74db3a7120c60f03d4f42bea4b608" + revision = "b99e34d8f73c46cb5e7fef35963a0b0bb89887eb" [[projects]] name = "github.com/pkg/errors" diff --git a/vendor/github.com/petergtz/pegomock/dsl.go b/vendor/github.com/petergtz/pegomock/dsl.go index 790dc9cd0..6c6f49fc8 100644 --- a/vendor/github.com/petergtz/pegomock/dsl.go +++ b/vendor/github.com/petergtz/pegomock/dsl.go @@ -173,7 +173,7 @@ func formatParams(params []Param) (result string) { if i > 0 { result += ", " } - result += fmt.Sprint(param) + result += fmt.Sprintf("%#v", param) } return } diff --git a/vendor/github.com/petergtz/pegomock/dsl_test.go b/vendor/github.com/petergtz/pegomock/dsl_test.go index ab3d1cd87..9a1ee7c35 100644 --- a/vendor/github.com/petergtz/pegomock/dsl_test.go +++ b/vendor/github.com/petergtz/pegomock/dsl_test.go @@ -556,8 +556,8 @@ var _ = Describe("MockDisplay", func() { "Mock invocation count for method \"Flash\" with params [wrong string -987] " + "does not match expectation.\n\n\tExpected: 1; but got: 0\n\n" + "\tBut other interactions with this mock were:\n" + - "\tFlash(Hello, 123)\n" + - "\tFlash(Again, 456)\n", + "\tFlash(\"Hello\", 123)\n" + + "\tFlash(\"Again\", 456)\n", )) }) @@ -569,11 +569,24 @@ var _ = Describe("MockDisplay", func() { "Mock invocation count for method \"Flash\" with params [wrong string -987] " + "does not match expectation.\n\n\tExpected: 1; but got: 0\n\n" + "\tBut other interactions with this mock were:\n" + - "\tFlash(Hello, 123)\n" + - "\tShow(Again)\n"), + "\tFlash(\"Hello\", 123)\n" + + "\tShow(\"Again\")\n"), ) }) + It("formats params in interactions with Go syntax for better readability", func() { + display.NetHttpRequestParam(http.Request{Host: "x.com"}) + Expect(func() { display.VerifyWasCalledOnce().NetHttpRequestParam(http.Request{Host: "y.com"}) }).To(PanicWith( + `Mock invocation count for method "NetHttpRequestParam" with params [{ 0 0 map[] 0 [] false y.com map[] map[] map[] }] does not match expectation. + + Expected: 1; but got: 0 + + But other interactions with this mock were: + NetHttpRequestParam(http.Request{Method:"", URL:(*url.URL)(nil), Proto:"", ProtoMajor:0, ProtoMinor:0, Header:http.Header(nil), Body:io.ReadCloser(nil), GetBody:(func() (io.ReadCloser, error))(nil), ContentLength:0, TransferEncoding:[]string(nil), Close:false, Host:"x.com", Form:url.Values(nil), PostForm:url.Values(nil), MultipartForm:(*multipart.Form)(nil), Trailer:http.Header(nil), RemoteAddr:"", RequestURI:"", TLS:(*tls.ConnectionState)(nil), Cancel:(<-chan struct {})(nil), Response:(*http.Response)(nil), ctx:context.Context(nil)}) +`, + )) + }) + It("shows no interactions if there were none", func() { Expect(func() { display.VerifyWasCalledOnce().Flash("wrong string", -987) }).To(PanicWith( "Mock invocation count for method \"Flash\" with params [wrong string -987] " +