Sha256: 4d26e1898caf2b653d1d3ff7acf6fb5cabd7ca5f5e9d37e0945750eb8d54fd5d

Contents?: true

Size: 994 Bytes

Versions: 24

Compression:

Stored size: 994 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
            children.each_with_index do |child, index|
              mutate_child(index) unless child.type == :str
            end
            emit_self(s(:str, EMPTY_STRING), options)
            emit_self(s(:str, NULL_REGEXP_SOURCE), options)
          end

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

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
mutant-0.5.10 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.9 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.8 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.7 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.6 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.5 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.4 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.3 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.2 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.1 lib/mutant/mutator/node/literal/regex.rb
mutant-0.5.0 lib/mutant/mutator/node/literal/regex.rb
mutant-0.3.6 lib/mutant/mutator/node/literal/regex.rb
mutant-0.3.5 lib/mutant/mutator/node/literal/regex.rb
mutant-0.3.4 lib/mutant/mutator/node/literal/regex.rb
mutant-0.3.3 lib/mutant/mutator/node/literal/regex.rb
mutant-0.3.2 lib/mutant/mutator/node/literal/regex.rb
mutant-0.3.1 lib/mutant/mutator/node/literal/regex.rb
mutant-0.3.0 lib/mutant/mutator/node/literal/regex.rb
mutant-0.3.0.rc5 lib/mutant/mutator/node/literal/regex.rb
mutant-0.3.0.rc4 lib/mutant/mutator/node/literal/regex.rb