diff --git a/lib/mutant/mutator/node/mlhs.rb b/lib/mutant/mutator/node/mlhs.rb index 7bddc758..d8016acf 100644 --- a/lib/mutant/mutator/node/mlhs.rb +++ b/lib/mutant/mutator/node/mlhs.rb @@ -19,7 +19,7 @@ module Mutant def dispatch children.each_index do |index| mutate_child(index) - delete_child(index) + delete_child(index) if children.length > 1 end end diff --git a/spec/unit/mutant/mutator/node/block/mutation_spec.rb b/spec/unit/mutant/mutator/node/block/mutation_spec.rb index e133cf89..5af30944 100644 --- a/spec/unit/mutant/mutator/node/block/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/block/mutation_spec.rb @@ -70,4 +70,26 @@ describe Mutant::Mutator, 'block' do it_should_behave_like 'a mutator' end + + context 'with mini block pattern arg' do + + before do + Mutant::Random.stub(hex_string: 'random') + end + + let(:source) { 'foo { |(a)| }' } + + let(:mutations) do + mutations = [] + mutations << 'foo { || }' + mutations << 'foo { |a| }' + mutations << 'foo { |(a)| raise }' + mutations << 'foo { |(srandom)| }' + mutations << 'foo' + mutations << 'nil' + end + + it_should_behave_like 'a mutator' + + end end