Class: Henitai::SlotScheduler::TestFileSelection
- Inherits:
-
Object
- Object
- Henitai::SlotScheduler::TestFileSelection
- Defined in:
- lib/henitai/slot_scheduler/test_file_selection.rb
Overview
Resolves the test files a mutant should be run against.
Three sources, in precedence order: a caller-supplied resolver lambda, a fixed list, or the integration's own per-subject selection. The first two exist so a survivor rerun or a per-test-coverage run can narrow the selection without the integration knowing about it.
Precedence is by key presence, not truthiness: an explicit empty list
means "no tests cover this", which the scheduler turns into
:no_coverage. Falling through to the integration there would silently
widen the selection back out.
Instance Method Summary collapse
- #for(mutant) ⇒ Object
-
#initialize(options:, integration:) ⇒ TestFileSelection
constructor
A new instance of TestFileSelection.
-
#resolved_empty?(test_files) ⇒ Boolean
True when the resolver was asked and came back empty.
Constructor Details
#initialize(options:, integration:) ⇒ TestFileSelection
Returns a new instance of TestFileSelection.
17 18 19 20 |
# File 'lib/henitai/slot_scheduler/test_file_selection.rb', line 17 def initialize(options:, integration:) @options = @integration = integration end |
Instance Method Details
#for(mutant) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/henitai/slot_scheduler/test_file_selection.rb', line 22 def for(mutant) if @options.key?(:test_file_resolver) @options[:test_file_resolver].call(mutant) elsif @options.key?(:test_files) @options[:test_files] else @integration.select_tests(mutant.subject) end end |
#resolved_empty?(test_files) ⇒ Boolean
True when the resolver was asked and came back empty. Only meaningful
for a resolver-driven run: a fixed empty test_files list is a
deliberate "run nothing", not an absence of coverage.
35 36 37 |
# File 'lib/henitai/slot_scheduler/test_file_selection.rb', line 35 def resolved_empty?(test_files) @options.key?(:test_file_resolver) && test_files.empty? end |