Move complex matcher building out of CLI responsibilities
This commit is contained in:
parent
c183652488
commit
0203fbf03d
3 changed files with 8 additions and 7 deletions
|
@ -195,6 +195,7 @@ require 'mutant/subject/method'
|
|||
require 'mutant/subject/method/instance'
|
||||
require 'mutant/subject/method/singleton'
|
||||
require 'mutant/matcher'
|
||||
require 'mutant/matcher/builder'
|
||||
require 'mutant/matcher/chain'
|
||||
require 'mutant/matcher/method'
|
||||
require 'mutant/matcher/method/finder'
|
||||
|
@ -217,7 +218,6 @@ require 'mutant/runner/subject'
|
|||
require 'mutant/runner/mutation'
|
||||
require 'mutant/runner/killer'
|
||||
require 'mutant/cli'
|
||||
require 'mutant/cli/builder'
|
||||
require 'mutant/color'
|
||||
require 'mutant/diff'
|
||||
require 'mutant/reporter'
|
||||
|
|
|
@ -39,7 +39,7 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def initialize(arguments = [])
|
||||
@builder = Builder.new
|
||||
@builder = Matcher::Builder.new
|
||||
@debug = @fail_fast = @zombie = false
|
||||
@expected_coverage = 100.0
|
||||
@strategy = Strategy::Null.new
|
||||
|
@ -101,13 +101,14 @@ module Mutant
|
|||
|
||||
# Parse matchers
|
||||
#
|
||||
# @param [Enumerable<String>] patterns
|
||||
# @param [Array<String>] patterns
|
||||
#
|
||||
# @return [undefined]
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
def parse_matchers(patterns)
|
||||
raise Error, 'No patterns given' if patterns.empty?
|
||||
patterns.each do |pattern|
|
||||
expression = Expression.parse(pattern)
|
||||
unless expression
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Mutant
|
||||
class CLI
|
||||
# Builder for configuration components
|
||||
class Matcher
|
||||
# Builder for complex matchers
|
||||
class Builder
|
||||
include NodeHelpers
|
||||
|
||||
|
@ -63,7 +63,7 @@ module Mutant
|
|||
#
|
||||
def matcher
|
||||
if @matchers.empty?
|
||||
raise(Error, 'No patterns given')
|
||||
return Matcher::Null.new
|
||||
end
|
||||
|
||||
matcher = Matcher::Chain.build(@matchers)
|
||||
|
@ -135,5 +135,5 @@ module Mutant
|
|||
end
|
||||
|
||||
end # Builder
|
||||
end # CLI
|
||||
end # Matcher
|
||||
end # Mutant
|
Loading…
Add table
Reference in a new issue