Merge pull request #136 from lgierth/empty-mlhs

Empty MLHS: SyntaxError
This commit is contained in:
Markus Schirp 2013-12-07 03:55:55 -08:00
commit 796135cbab
2 changed files with 23 additions and 1 deletions

View file

@ -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

View file

@ -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