Skip to content

Commit

Permalink
Add ordering mutations
Browse files Browse the repository at this point in the history
[fix #1442]
  • Loading branch information
mbj committed May 12, 2024
1 parent dae46ad commit c4c7d43
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/mutant/mutation/operators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@ class Full < self
all?: %i[any?],
any?: %i[all?],
at: %i[fetch key?],
detect: %i[first last],
fetch: %i[key?],
find: %i[first last],
flat_map: %i[map],
gsub: %i[sub],
is_a?: %i[instance_of?],
kind_of?: %i[instance_of?],
map: %i[each],
match: %i[match?],
max: %i[first last],
max_by: %i[first last],
method: %i[public_method],
min: %i[first last],
min_by: %i[first last],
reverse_each: %i[each],
reverse_map: %i[map each],
reverse_merge: %i[merge],
Expand Down
23 changes: 23 additions & 0 deletions meta/send.rb
Original file line number Diff line number Diff line change
Expand Up @@ -884,3 +884,26 @@
mutation 'foo(nil)'
mutation 'foo(:"+__mutant__")'
end

%w[detect find max max_by min min_by].each do |selector|
Mutant::Meta::Example.add :send do
source selector

singleton_mutations

mutation 'first'
mutation 'last'
end

Mutant::Meta::Example.add :send do
source "#{selector}(&:block)"

singleton_mutations

mutation "#{selector}(&:block__mutant__)"
mutation "#{selector}(&nil)"
mutation 'first(&:block)'
mutation 'last(&:block)'
mutation selector
end
end

0 comments on commit c4c7d43

Please sign in to comment.