free_mutant/lib/mutant/config.rb

55 lines
1 KiB
Ruby
Raw Normal View History

module Mutant
# The configuration of a mutator run
class Config
include Adamantium::Flat, Anima.new(
:debug,
2014-06-28 23:04:18 +00:00
:integration,
:matcher,
:reporter,
:fail_fast,
:zombie,
:expected_coverage
)
2013-03-27 15:52:02 +01:00
# Enumerate subjects
#
# @api private
#
# @return [self]
# if block given
#
# @return [Enumerator<Subject>]
# otherwise
#
# @api private
#
def subjects(&block)
return to_enum(__method__) unless block_given?
matcher.each(&block)
2013-03-27 15:52:02 +01:00
self
end
2014-06-28 22:54:28 +00:00
# Return tests for mutation
#
# TODO: This logic is now centralized but still fucked.
#
# @param [Mutation] mutation
#
# @return [Enumerable<Test>]
#
# @api private
#
def tests(subject)
subject.match_expressions.each do |match_expression|
2014-06-28 23:04:18 +00:00
tests = integration.all_tests.select do |test|
2014-06-28 22:54:28 +00:00
match_expression.prefix?(test.expression)
end
return tests if tests.any?
end
EMPTY_ARRAY
end
2013-06-14 20:54:02 +02:00
end # Config
end # Mutant