diff --git a/lib/mutant/mutator/node/named_value/constant_assignment.rb b/lib/mutant/mutator/node/named_value/constant_assignment.rb index 2b9474f9..005105d3 100644 --- a/lib/mutant/mutator/node/named_value/constant_assignment.rb +++ b/lib/mutant/mutator/node/named_value/constant_assignment.rb @@ -17,7 +17,7 @@ module Mutant # @return [undefined] def dispatch mutate_name - emit_value_mutations + emit_value_mutations if value emit_remove_const end diff --git a/meta/or_asgn.rb b/meta/or_asgn.rb index 5660203f..4fd3d6f7 100644 --- a/meta/or_asgn.rb +++ b/meta/or_asgn.rb @@ -21,6 +21,12 @@ Mutant::Meta::Example.add do mutation '@a ||= 2' end +Mutant::Meta::Example.add do + source 'Foo ||= nil' + + singleton_mutations +end + Mutant::Meta::Example.add do source '@a ||= self.bar' diff --git a/spec/integrations.yml b/spec/integrations.yml index 20356014..39c00a28 100644 --- a/spec/integrations.yml +++ b/spec/integrations.yml @@ -1,18 +1,17 @@ --- - name: rubyspec namespace: Rubyspec - repo_uri: 'https://github.com/rubyspec/rubyspec.git' + repo_uri: 'https://github.com/ruby/rubyspec.git' mutation_coverage: false mutation_generation: true expect_coverage: 0 # not run exclude: # Binary encoded source subjected to limitations see README of unparser - core/array/pack/{b,h,u}_spec.rb - - language/versions/*1.8* + - language/regexp/escapes_spec.rb - core/array/pack/shared/float.rb - core/array/pack/shared/integer.rb - core/array/pack/{c,m,w}_spec.rb - - core/regexp/shared/new.rb - core/regexp/shared/quote.rb - core/encoding/compatible_spec.rb - core/io/readpartial_spec.rb diff --git a/spec/support/corpus.rb b/spec/support/corpus.rb index 3dee8e9d..6306e816 100644 --- a/spec/support/corpus.rb +++ b/spec/support/corpus.rb @@ -10,10 +10,18 @@ module MutantSpec # # rubocop:disable MethodLength module Corpus + TMP = ROOT.join('tmp').freeze + EXCLUDE_GLOB_FORMAT = '{%s}'.freeze + RUBY_GLOB_PATTERN = '**/*.rb'.freeze + + # Not in the docs. Number from chatting with their support. + # 2 processors allocated per container, 4 processes works well. + CIRCLE_CI_CONTAINER_PROCESSES = 4 + + private_constant(*constants(false)) + # Project under corpus test # rubocop:disable ClassLength - TMP = ROOT.join('tmp').freeze - class Project MUTEX = Mutex.new include Adamantium, Anima.new( @@ -58,18 +66,16 @@ module MutantSpec # # @raise [Exception] # otherwise - # - # rubocop:disable AbcSize def verify_mutation_generation checkout start = Time.now - paths = Pathname.glob(repo_path.join('**/*.rb')).sort_by(&:size).reverse + options = { finish: method(:finish), start: method(:start), in_processes: parallel_processes } - total = Parallel.map(paths, options) do |path| + total = Parallel.map(effective_ruby_paths, options) do |path| count = 0 node = begin @@ -134,15 +140,31 @@ module MutantSpec system(%w[bundle]) end - # Not in the docs. Number from chatting with their support. - CIRCLE_CI_CONTAINER_PROCESSES = 2 + # The effective ruby file paths + # + # @return [Array] + def effective_ruby_paths + paths = Pathname + .glob(repo_path.join(RUBY_GLOB_PATTERN)) + .sort_by(&:size) + .reverse + + paths - excluded_paths + end + + # The excluded file paths + # + # @return [Array] + def excluded_paths + Pathname.glob(repo_path.join(EXCLUDE_GLOB_FORMAT % exclude.join(','))) + end # Number of parallel processes to use # # @return [Fixnum] def parallel_processes - if ENV['CI'] - Mutant::Config::DEFAULT.jobs + if ENV.key?('CI') + CIRCLE_CI_CONTAINER_PROCESSES else Parallel.processor_count end