mutant
mutant copied to clipboard
feat: Additional mutations around ordering
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.