lib/mutant/mutator/node/send/binary.rb in mutant-0.8.3 vs lib/mutant/mutator/node/send/binary.rb in mutant-0.8.4

- old
+ new

@@ -17,11 +17,35 @@ # @api private def dispatch emit(left) emit_left_mutations emit_selector_replacement - emit(right) unless n_splat?(right) + emit(right) emit_right_mutations + emit_not_equality_mutations + end + + # Emit mutations for `!=` + # + # @return [undefined] + # + # @api private + def emit_not_equality_mutations + return unless operator.equal?(:'!=') + + emit_not_equality_mutation(:eql?) + emit_not_equality_mutation(:equal?) + end + + # Emit negated method sends with specified operator + # + # @param new_operator [Symbol] selector to be negated + # + # @return [undefined] + # + # @api private + def emit_not_equality_mutation(new_operator) + emit(n_not(s(:send, left, new_operator, right))) end end # Binary end # Send