Sha256: c563aba7d5d101f0ea00aae4cead67e9d8bbd89eb687ce3f75c2a309635d7d8d

Contents?: true

Size: 1013 Bytes

Versions: 7

Compression:

Stored size: 1013 Bytes

Contents

# encoding: utf-8

module Mutant
  class Mutator
    class Node
      class Literal < self
        # Mutator for regexp literals
        class Regex < self

          handle(:regexp)

          # No input can ever be matched with this
          NULL_REGEXP_SOURCE = 'a\A'.freeze

        private

          # Return options
          #
          # @return [Parser::AST::Node]
          #
          # @api private
          #
          def options
            children.last
          end

          # Emit mutants
          #
          # @return [undefined]
          #
          # @api private
          #
          def dispatch
            emit_nil unless parent_type == :match_current_line
            children.each_with_index do |child, index|
              mutate_child(index) unless child.type == :str
            end
            emit_self(options)
            emit_self(s(:str, NULL_REGEXP_SOURCE), options)
          end

        end # Regex
      end # Literal
    end # Node
  end # Mutator
end # Mutant

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mutant-0.5.17 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.16 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.15 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.14 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.13 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.12 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.11 lib/mutant/mutator/node/literal/regex.rb