Class: Mutineer::Mutators::BooleanLiteral

Inherits:
Base
  • Object
show all
Defined in:
lib/mutineer/mutators/boolean_literal.rb

Overview

Mutates true/false AND nil literals — "boolean_literal" is the spec's name for the family (§4), so nil is in-scope by design even though it is not strictly a boolean. true<->false, and nil->true (nil->true catches more return-value gaps than nil->false). Rewrites the whole node location; these nodes have no sub-token location.

Clean-room: from the spec's operator table, not the mutant gem.

Instance Method Summary collapse

Methods inherited from Base

#mutations_for

Instance Method Details

#visit_false_node(node) ⇒ Object



20
21
22
23
# File 'lib/mutineer/mutators/boolean_literal.rb', line 20

def visit_false_node(node)
  emit(node, "true")
  super
end

#visit_nil_node(node) ⇒ Object



25
26
27
28
# File 'lib/mutineer/mutators/boolean_literal.rb', line 25

def visit_nil_node(node)
  emit(node, "true")
  super
end

#visit_true_node(node) ⇒ Object



15
16
17
18
# File 'lib/mutineer/mutators/boolean_literal.rb', line 15

def visit_true_node(node)
  emit(node, "false")
  super
end