free_mutant/lib/mutant/mutator/literal/boolean.rb

48 lines
938 B
Ruby
Raw Normal View History

module Mutant
class Mutator
2012-08-09 23:07:22 +02:00
class Literal < self
# Abstract mutator for boolean literals
2012-08-09 23:07:22 +02:00
class Boolean < self
private
# Emit mutants
#
# @return [undefined]
#
# @api private
#
def dispatch
emit_nil
emit_safe(inverse)
end
# Return inverse
#
# @return [Rubinius::AST::Node]
#
# @api private
#
2012-08-03 01:38:35 +02:00
def inverse
new(self.class::INVERSE_CLASS)
end
# Represent mutations of true literal
2012-08-09 23:07:22 +02:00
class TrueLiteral < self
2012-08-03 01:38:35 +02:00
INVERSE_CLASS = Rubinius::AST::FalseLiteral
handle(Rubinius::AST::TrueLiteral)
end
# Represent mutations of false literal
2012-08-09 23:07:22 +02:00
class FalseLiteral < self
2012-08-03 01:38:35 +02:00
INVERSE_CLASS = Rubinius::AST::TrueLiteral
handle(Rubinius::AST::FalseLiteral)
end
end
end
end
end