Fix propagation of splat args

Closes #39
This commit is contained in:
Markus Schirp 2013-06-21 16:18:11 +02:00
parent ee6b8ddb71
commit 8b7be8a565
3 changed files with 14 additions and 7 deletions

View file

@ -9,12 +9,8 @@ module Mutant
:self, :zsuper, :not, :or, :and, :defined, :self, :zsuper, :not, :or, :and, :defined,
:next, :break, :match, :gvar, :cvar, :ensure, :rescue, :next, :break, :match, :gvar, :cvar, :ensure, :rescue,
:dstr, :dsym, :yield, :begin, :rescue, :gvasgn, :dstr, :dsym, :yield, :begin, :rescue, :gvasgn,
:lvar, :lvar, :splat, :const, :blockarg, :block_pass,
:const, :ivar, :restarg
:blockarg,
:block_pass,
:ivar,
:restarg
) )
private private

View file

@ -19,7 +19,7 @@ module Mutant
def dispatch def dispatch
emit(left) emit(left)
emit_left_mutations emit_left_mutations
emit(right) emit(right) unless right.type == :splat
emit_right_mutations emit_right_mutations
end end

View file

@ -12,6 +12,17 @@ describe Mutant::Mutator, 'send' do
end end
end end
context 'single splat arg splat' do
let(:source) { 'foo[*bar]' }
let(:mutations) do
mutations = []
mutations << 'foo'
end
it_should_behave_like 'a mutator'
end
context 'with self as' do context 'with self as' do
context 'implicit' do context 'implicit' do
let(:source) { 'foo' } let(:source) { 'foo' }