Skip to content

Commit

Permalink
Fixing issue of passing varargs and string to Sprintf. Closes stretch…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinesh Kumar committed Jun 22, 2018
1 parent f35b8ab commit 1d8959c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ func (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interfac
}
if len(calledWithArgs) == 0 {
return assert.Fail(t, "Should have called with given arguments",
fmt.Sprintf("Expected %q to have been called with:\n%v\nbut no actual calls happened", methodName, arguments))
fmt.Sprintf("Expected %q to have been called with:\n%v\nbut no actual calls happened", methodName, []interface{}(arguments)))
}
return assert.Fail(t, "Should have called with given arguments",
fmt.Sprintf("Expected %q to have been called with:\n%v\nbut actual calls were:\n %v", methodName, arguments, strings.Join(calledWithArgs, "\n")))
Expand All @@ -513,7 +513,7 @@ func (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...inter
defer m.mutex.Unlock()
if m.methodWasCalled(methodName, arguments) {
return assert.Fail(t, "Should not have called with given arguments",
fmt.Sprintf("Expected %q to not have been called with:\n%v\nbut actually it was.", methodName, arguments))
fmt.Sprintf("Expected %q to not have been called with:\n%v\nbut actually it was.", methodName, []interface{}(arguments)))
}
return true
}
Expand Down

0 comments on commit 1d8959c

Please sign in to comment.