Class: Evilution::Mutator::Operator::PatternPredicate Private
- Defined in:
- lib/evilution/mutator/operator/pattern_predicate.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 one-line pattern match with false: x in Integer becomes
false.
The mutant differs from the original only on inputs the pattern actually matches, so a survivor means no test ever feeds it a matching value -- the true path of the predicate is unexercised.
Only Prism::MatchPredicateNode is mutated. Its sibling MatchRequiredNode
(x => Integer) raises NoMatchingPatternError rather than returning a
boolean, so false would not stand in for it.
Instance Attribute Summary
Attributes inherited from Base
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_match_predicate_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.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/evilution/mutator/operator/pattern_predicate.rb', line 16 def visit_match_predicate_node(node) location = node.location add_mutation( offset: location.start_offset, length: location.length, replacement: "false", node: node ) super end |