free_mutant/lib/mutant/selector/expression.rb
Markus Schirp 207c159c23 Always build valid result objects
* Before Mutant::Expression was not marshallable resulting in the need
  to build "partial" result objects from killforks.
* Fixes an adjacent bug in spec selection
2014-12-22 17:54:20 +00:00

28 lines
657 B
Ruby

module Mutant
class Selector
# Expression based test selector
class Expression < self
include Concord.new(:integration)
# Return tests for subject
#
# @param [Subject] subject
#
# @return [Enumerable<Test>]
#
# @api private
#
def call(subject)
subject.match_expressions.each do |match_expression|
subject_tests = integration.all_tests.select do |test|
match_expression.prefix?(test.expression)
end
return subject_tests if subject_tests.any?
end
EMPTY_ARRAY
end
end # Expression
end # Selector
end # Mutant