Skip to content

Commit

Permalink
Only say another call if it has been called before
Browse files Browse the repository at this point in the history
  • Loading branch information
brackendawson committed Jul 26, 2021
1 parent bd7b872 commit ab301b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mock/mock.go
Expand Up @@ -457,7 +457,7 @@ func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Argumen
m.fail("mock: Unexpected Method Call\n-----------------------------\n\n%s\n\nMust not be called before%s:\n\n%s",
callString(call.Method, call.Arguments, true),
func() (s string) {
if requirement.Repeatability+requirement.totalCalls > 1 {
if requirement.totalCalls > 0 {
s = " another call of"
}
if call.Parent != requirement.Parent {
Expand Down
2 changes: 1 addition & 1 deletion mock/mock_test.go
Expand Up @@ -738,7 +738,7 @@ func Test_Mock_Return_NotBefore_Out_Of_Order(t *testing.T) {

b := mockedService.
On("TheExampleMethod", 1, 2, 3).
Return(4, nil)
Return(4, nil).Twice()
c := mockedService.
On("TheExampleMethod2", true).
Return().
Expand Down

0 comments on commit ab301b7

Please sign in to comment.