Class: Evilution::Mutator::Operator::LoopBodyToRaise Private

Inherits:
Base
  • Object
show all
Defined in:
lib/evilution/mutator/operator/loop_body_to_raise.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Replace a loop body with a bare raise: while c; body; end becomes while c; raise; end.

A survivor means no test ever enters the loop, so the body is either dead or reached only by paths the suite never exercises. The raise terminates the loop on its first iteration, which is what makes this safe where body-to-nil is not: nil-ing a body that advances the predicate spins until the per-mutation timeout (EV-170m.7).

Instance Attribute Summary

Attributes inherited from Base

#mutations

Instance Method Summary collapse

Methods inherited from Base

#call, clear_parse_cache!, #initialize, operator_name, parsed_tree_for

Constructor Details

This class inherits a constructor from Evilution::Mutator::Base

Instance Method Details

#visit_until_node(node) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
22
# File 'lib/evilution/mutator/operator/loop_body_to_raise.rb', line 19

def visit_until_node(node)
  replace_body_with_raise(node)
  super
end

#visit_while_node(node) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
17
# File 'lib/evilution/mutator/operator/loop_body_to_raise.rb', line 14

def visit_while_node(node)
  replace_body_with_raise(node)
  super
end