free_mutant/lib/mutant/mutator/node/literal/regex.rb
Markus Schirp 6b2e2a8bb0 Initial round of refactoring
* Remove some RBX only nodes
* Register parser types
* Remove all occurences of ::Rubinius when loading libraries
2013-06-14 21:11:54 +02:00

44 lines
986 B
Ruby

module Mutant
class Mutator
class Node
class Literal < self
# Mutator for regexp literals
class Regex < self
handle(:regexp)
private
# Emit mutants
#
# @return [undefined]
#
# @api private
#
def dispatch
emit_nil
emit_self('') # match all
emit_self('a\A') # match nothing
emit_new { new_self(Random.hex_string) }
end
# Return new regexp node
#
# @param [String] source
#
# @param [Integer] options
# options of regexp, defaults to mutation subject node options
#
# @return [undefined]
#
# @api private
#
def new_self(source,options=nil)
super(source,options || node.options)
end
end # Regex
end # Literal
end # Node
end # Mutator
end # Mutant