Sha256: b61cde8c31b2095f16b0c165ad4db0a5d17fa083110715ed20be7485d446668a

Contents?: true

Size: 1.2 KB

Versions: 17

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

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

17 entries across 17 versions & 1 rubygems

Version Path
mutant-0.9.8 lib/mutant/mutator/node/send/binary.rb
mutant-0.9.7 lib/mutant/mutator/node/send/binary.rb
mutant-0.9.6 lib/mutant/mutator/node/send/binary.rb
mutant-0.9.5 lib/mutant/mutator/node/send/binary.rb
mutant-0.9.4 lib/mutant/mutator/node/send/binary.rb
mutant-0.9.3 lib/mutant/mutator/node/send/binary.rb
mutant-0.9.2 lib/mutant/mutator/node/send/binary.rb
mutant-0.9.1 lib/mutant/mutator/node/send/binary.rb
mutant-0.9.0 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.24 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.23 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.22 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.21 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.20 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.19 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.18 lib/mutant/mutator/node/send/binary.rb
mutant-0.8.17 lib/mutant/mutator/node/send/binary.rb