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

feat: add argument to speecify custom mock names #57

Merged
merged 1 commit into from Jun 21, 2021

Conversation

damianopetrungaro
Copy link
Contributor

I had to duplicate the tests since those can't use (easily) table-driven tests due to the nested mock operations needed.

@damianopetrungaro
Copy link
Contributor Author

Fixes: #56

Copy link
Collaborator

@hexdigest hexdigest left a comment

Choose a reason for hiding this comment

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

Hey @damianopetrungaro, thank you for making it real! :) I was thinking about this for a couple of years already.

if *aliases != "" {
mockNames = strings.Split(*aliases, ",")
}
if len(mockNames) != 0 && len(mockNames) != len(interfaces) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please make sure that -i option doesn't contain any wildcards when -n is given? This will generate mock with the same name for every interface in the package. Let's say we have -i io.* -n IOMock then we'll have same IOMock name for both io.Reader and io.Writer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hexdigest done :)

@damianopetrungaro
Copy link
Contributor Author

@hexdigest 🏓

No rush, just wanna make sure this one doesn't end lost in your notification in the same way as some of the PR I need to review 😄

@hexdigest hexdigest merged commit 7e0b6d3 into gojuno:master Jun 21, 2021
@hexdigest
Copy link
Collaborator

Thank you Damian!

@hexdigest
Copy link
Collaborator

@damianopetrungaro this should be working in v3.0.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants