Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mock: improve MatchedBy failed comparison Diff message #1074

Merged
merged 1 commit into from Aug 24, 2021

Conversation

perrydunn
Copy link
Contributor

Summary

Improve the Diff message for mock.MatchedBy functions taking a reference type.

Changes

The argumentMatcher.String method internally now uses the reflect.Type.String method instead of the reflect.Type.Name method.

Motivation

Prior to this change a mock.MatchedBy function taking a reference type, such as a slice (func([]int) bool), would have the Diff presented as ... func() bool; now the Diff will accurately be presented as ... func([]int) bool.

Related issues

N/A

@perrydunn
Copy link
Contributor Author

@boyan-soubachov Please could you take a look?

Copy link
Collaborator

@boyan-soubachov boyan-soubachov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution :)

@boyan-soubachov boyan-soubachov merged commit e209ca8 into stretchr:master Aug 24, 2021
@dolmen dolmen added enhancement pkg-mock Any issues related to Mock mock.ArgumentMatcher About matching arguments in mock labels Mar 22, 2024
@dolmen dolmen changed the title Improve mock.MatchedBy failed comparison Diff message mock: improve MatchedBy failed comparison Diff message Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement mock.ArgumentMatcher About matching arguments in mock pkg-mock Any issues related to Mock
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants