diff --git a/lib/mutant/mutation/operators.rb b/lib/mutant/mutation/operators.rb index 770c5e201..e66f88da1 100644 --- a/lib/mutant/mutation/operators.rb +++ b/lib/mutant/mutation/operators.rb @@ -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], diff --git a/meta/send.rb b/meta/send.rb index 022e2d526..d4b2c2e9c 100644 --- a/meta/send.rb +++ b/meta/send.rb @@ -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