free_mutant/lib/mutant/mutator/node/literal/regex.rb
Markus Schirp 1d981afae8 Move more literals to constants
As constans the literals get frozen. This improves sharpness of API use.
2013-07-21 22:19:41 +02:00

33 lines
691 B
Ruby

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
children :source, :options
private
# Emit mutants
#
# @return [undefined]
#
# @api private
#
def dispatch
emit_nil
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