Repository: stretchr/testify (go)

Issue:
Panic in mock.Arguments.String
A regression in callString():
```
panic(0x28ff20, 0xdd3bc0)
	/usr/local/go/src/runtime/panic.go:967 +0x166
github.com/stretchr/testify/mock.Arguments.String(0xc000474840, 0x2, 0x2, 0x0, 0x0, 0x0, 0x1, 0x1)
	third-party-source/go/github.com/stretchr/testify/mock/mock.go:833 +0xd1
github.com/stretchr/testify/mock.(*Mock).AssertExpectations(0xc0000a8640, 0x4f7a00, 0xc000199b00, 0x4f3500)
	third-party-source/go/github.com/stretchr/testify/mock/mock.go:464 +0x3b3
```

A proposed fix is coming shortly.

Pull request description:
mock: callString to handle nil nicely
## Summary
Fixes a regression in `testify/mock`.
## Changes
Handle nil in Arguments.String() by employing fmt.Sprint().

## Motivation
A regression introduced while replacing `fmt.Sprint()` with `reflect.TypeOf(arg)` in `Arguments.String()`: `reflect.TypeOf(nil)` returns `nil` which is its documented behaviour. A null pointer dereference is what follows.

A unit test case added.

## Related issues
Closes #936.


Patch:
diff --git a/mock/mock.go b/mock/mock.go
index a6d9526..c6df448 100644
--- a/mock/mock.go
+++ b/mock/mock.go
@@ -855,7 +855,7 @@ func (args Arguments) String(indexOrNil ...int) string {
 		// normal String() method - return a string representation of the args
 		var argsStr []string
 		for _, arg := range args {
-			argsStr = append(argsStr, reflect.TypeOf(arg).String())
+			argsStr = append(argsStr, fmt.Sprintf("%T", arg)) // handles nil nicely
 		}
 		return strings.Join(argsStr, ",")
 	} else if len(indexOrNil) == 1 {


Test patch:
diff --git a/mock/mock_test.go b/mock/mock_test.go
index 1b681aa..cb49541 100644
--- a/mock/mock_test.go
+++ b/mock/mock_test.go
@@ -778,6 +778,7 @@ func Test_Mock_findExpectedCall_Respects_Repeatability(t *testing.T) {
 func Test_callString(t *testing.T) {
 
 	assert.Equal(t, `Method(int,bool,string)`, callString("Method", []interface{}{1, true, "something"}, false))
+	assert.Equal(t, `Method(<nil>)`, callString("Method", []interface{}{nil}, false))
 
 }