lib/mutant/mutator/node/send.rb in mutant-0.10.24 vs lib/mutant/mutator/node/send.rb in mutant-0.10.25
- old
+ new
@@ -15,10 +15,12 @@
SELECTOR_REPLACEMENTS = IceNine.deep_freeze(
:< => %i[== eql? equal?],
:<= => %i[< == eql? equal?],
:== => %i[eql? equal?],
+ :=== => %i[is_a?],
+ :=~ => %i[match?],
:> => %i[== eql? equal?],
:>= => %i[> == eql? equal?],
__send__: %i[public_send],
all?: %i[any?],
any?: %i[all?],
@@ -29,10 +31,11 @@
gsub: %i[sub],
is_a?: %i[instance_of?],
kind_of?: %i[instance_of?],
map: %i[each],
method: %i[public_method],
+ match: %i[match?],
reverse_each: %i[each],
reverse_map: %i[map each],
reverse_merge: %i[merge],
send: %i[public_send __send__],
to_a: %i[to_ary],
@@ -79,16 +82,24 @@
mutate_receiver
mutate_arguments
end
def emit_selector_specific_mutations
+ emit_predicate_mutations
emit_array_mutation
emit_static_send
emit_const_get_mutation
emit_integer_mutation
emit_dig_mutation
emit_double_negation_mutation
emit_lambda_mutation
+ end
+
+ def emit_predicate_mutations
+ return unless selector.match?(/\?\z/) && !selector.equal?(:defined?)
+
+ emit(s(:true))
+ emit(s(:false))
end
def emit_array_mutation
return unless selector.equal?(:Array) && possible_kernel_method?