diff --git a/lib/mutant.rb b/lib/mutant.rb index a52749fe..c9299d7e 100644 --- a/lib/mutant.rb +++ b/lib/mutant.rb @@ -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' diff --git a/lib/mutant/cli.rb b/lib/mutant/cli.rb index 4ae19d8c..bd99743b 100644 --- a/lib/mutant/cli.rb +++ b/lib/mutant/cli.rb @@ -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] patterns + # @param [Array] 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 diff --git a/lib/mutant/cli/builder.rb b/lib/mutant/matcher/builder.rb similarity index 96% rename from lib/mutant/cli/builder.rb rename to lib/mutant/matcher/builder.rb index 215199d2..b007da83 100644 --- a/lib/mutant/cli/builder.rb +++ b/lib/mutant/matcher/builder.rb @@ -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