Class: Mutant::Selector::ContextMap Private
- Inherits:
-
Mutant::Selector
- Object
- Mutant::Selector
- Mutant::Selector::ContextMap
- Defined in:
- lib/mutant/selector/context_map.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.
Test selector backed by a per test coverage recording
Selects the tests that executed the subject's own source lines, which finds the tests that cover a subject regardless of where they live or how they are named. Subjects the recording says nothing about fall back to the expression selector: code that only runs while the suite loads (a constant body, a class level DSL call) executes under no test, and reporting its mutations alive without running a single test would be a lie.
Instance Method Summary collapse
-
#call(subject) ⇒ Enumerable<Test>
private
Tests for subject, likeliest killer first.
-
#name ⇒ String
private
Name of the strategy this selector implements.
-
#unmatched? ⇒ Boolean
private
Whether the recording names no test this suite runs.
Instance Method Details
#call(subject) ⇒ Enumerable<Test>
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.
Tests for subject, likeliest killer first
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/mutant/selector/context_map.rb', line 26 def call(subject) reach = context_map.reach(path: subject.source_path, lines: subject.source_lines) covering = reach.flat_map do |location, lines| index.fetch(location, EMPTY_ARRAY).map { |test| [test, lines, context_map.footprint(location)] } end return fallback.call(subject) if covering.empty? order(covering, subject) end |
#name ⇒ String
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.
Name of the strategy this selector implements
19 |
# File 'lib/mutant/selector/context_map.rb', line 19 def name = 'context_map' |
#unmatched? ⇒ Boolean
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.
Whether the recording names no test this suite runs
A recording taken from another project root, or from a suite that has since been renamed away, covers everything and matches nothing. Left unsaid it looks exactly like a suite in which no test covers anything.
45 46 47 |
# File 'lib/mutant/selector/context_map.rb', line 45 def unmatched? index.each_key.none? { |location| context_map.context_ids.include?(location) } end |