2013-02-24 20:40:23 +01:00
|
|
|
module Mutant
|
|
|
|
# The configuration of a mutator run
|
|
|
|
class Config
|
|
|
|
include Adamantium::Flat, Anima.new(
|
2013-09-13 22:28:04 +02:00
|
|
|
:debug,
|
2014-06-28 23:04:18 +00:00
|
|
|
:integration,
|
2013-09-13 22:28:04 +02:00
|
|
|
:matcher,
|
|
|
|
:reporter,
|
|
|
|
:fail_fast,
|
2014-01-19 00:06:40 +01:00
|
|
|
:zombie,
|
|
|
|
:expected_coverage
|
2013-02-24 20:40:23 +01:00
|
|
|
)
|
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?
|
2014-02-02 22:48:08 +01:00
|
|
|
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
|