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: Additional mutations around ordering #1442

Closed
AndrewSwerlick opened this issue May 9, 2024 · 1 comment · Fixed by #1444
Closed

feat: Additional mutations around ordering #1442

AndrewSwerlick opened this issue May 9, 2024 · 1 comment · Fixed by #1444

Comments

@AndrewSwerlick
Copy link

Suggestion:

Mutant should include mutations that replace methods like find/detect/min/max/min_by/max_by/last with first and last

Justification

The methods min/max/min_by/max_by all accept a block. However if there is only 1 item in the collection, the block will not executed, and potentially remain untested. It's an easy fact to overlook in your tests. In those situations a mutation to first will result in a live mutation, making the missing coverage obvious.

Additionally mutating to last will detect when your sort conditions aren't being properly exercised because all the records sort in the same order.

find/detect are some what different, since the blocks for those methods will always execute, but it will still help to ensure that your test setup creates collections that both include and exclude the values you're working with.

mbj added a commit that referenced this issue May 12, 2024
mbj added a commit that referenced this issue May 12, 2024
@mbj
Copy link
Owner

mbj commented May 12, 2024

@AndrewSwerlick I like this but split out #last -> #first and vice versa to just the full operator set (mutant config) due to the history of these mutations. See changelog in #1444.

@mbj mbj closed this as completed in #1444 May 12, 2024
mbj added a commit that referenced this issue May 12, 2024
mbj added a commit that referenced this issue May 12, 2024
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 a pull request may close this issue.

2 participants