Class: Evilution::Mutator::Operator::CaseIn Private

Inherits:
Base
  • Object
show all
Defined in:
lib/evilution/mutator/operator/case_in.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.

Drop one in clause from a case/in, leaving the rest of the arms in place.

Input that used to match the removed pattern now falls through to a later arm, to the else, or -- with neither -- raises NoMatchingPatternError. A survivor means the suite never exercises that arm, so its pattern could be deleted outright without any test noticing.

Pattern matching had no visitor at all before this operator: the case/in grammar is a CaseMatchNode of InNodes, unrelated to the CaseNode/WhenNode pair CaseWhen handles.

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_case_match_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.



17
18
19
20
21
# File 'lib/evilution/mutator/operator/case_in.rb', line 17

def visit_case_match_node(node)
  remove_in_clauses(node)
  remove_else_branch(node)
  super
end