Sha256: d1462ebd226c3be3359cc9c931be6baa79d28d2824a16e897cc416bcd354b092

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

module Mutant
  class Mutator
    class Node
      class Send

        # Mutator for sends that correspond to a binary operator
        class Binary < self

          children :left, :operator, :right

        private

          # Emit mutations
          #
          # @return [undefined]
          def dispatch
            emit(left)
            emit_left_mutations
            emit_selector_replacement
            emit(right)
            emit_right_mutations
            emit_not_equality_mutations
          end

          # Emit mutations for `!=`
          #
          # @return [undefined]
          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]
          def emit_not_equality_mutation(new_operator)
            emit(n_not(s(:send, left, new_operator, right)))
          end

        end # Binary

      end # Send
    end # Node
  end # Mutator
end # Mutant

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutant-0.8.16 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.15 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.14 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.13 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.12 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.11 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.10 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.9 lib/mutant/mutator/node/send/binary.rb