Skip to content

mock: fix erroneous calledWithArgs messages#1258

Open
kleinerhund wants to merge 1 commit into
stretchr:masterfrom
kleinerhund:fix-assertcalled-wrong-output
Open

mock: fix erroneous calledWithArgs messages#1258
kleinerhund wants to merge 1 commit into
stretchr:masterfrom
kleinerhund:fix-assertcalled-wrong-output

Conversation

@kleinerhund
Copy link
Copy Markdown

Summary

AssertCalled(...) displays output from other methods when the assertion fails.

Changes

Added a check that the called method name matches that of the asserted method name. Same as in AssertNumberOfCalls(...).

Motivation

AssertCalled(...) fails for the correct assertion, however the output displayed can sometimes indicate that the method was called with arguments from other methods.

Related issues

Closes #1144

@dolmen dolmen added the pkg-mock Any issues related to Mock label Oct 16, 2023
@dolmen dolmen changed the title fix erroneous calledWithArgs messages mock: fix erroneous calledWithArgs messages Oct 16, 2023
@brackendawson brackendawson added this to the v1.8.6 milestone Feb 24, 2024
@brackendawson brackendawson modified the milestones: v1.9.1, v1.10 Mar 5, 2024
@brackendawson brackendawson modified the milestones: v1.10, v1.10.1 Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg-mock Any issues related to Mock

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mock: AssertCalled confuses separate method calls in assert message

4 participants