Add dedicated splat mutator

Closes #66
This commit is contained in:
Markus Schirp 2013-07-15 22:25:09 +02:00
parent b2a7c97606
commit ad162c2a42
4 changed files with 31 additions and 1 deletions

View file

@ -69,6 +69,7 @@ require 'mutant/mutator/node/return'
require 'mutant/mutator/node/block'
require 'mutant/mutator/node/if'
require 'mutant/mutator/node/case'
require 'mutant/mutator/node/splat'
require 'mutant/config'
require 'mutant/loader'
require 'mutant/context'

View file

@ -12,7 +12,7 @@ module Mutant
:zsuper, :not, :or, :and, :defined,
:next, :break, :match, :gvar, :cvar, :ensure,
:dstr, :dsym, :yield, :rescue, :redo, :defined?,
:lvar, :splat, :const, :blockarg, :block_pass, :op_asgn, :and_asgn,
:lvar, :const, :blockarg, :block_pass, :op_asgn, :and_asgn,
:regopt, :ivar, :restarg, :casgn, :resbody, :retry, :arg_expr,
:kwrestarg, :kwoptarg, :kwarg, :undef, :module, :cbase, :empty,
:alias, :for, :xstr, :back_ref, :nth_ref, :class,

View file

@ -0,0 +1,27 @@
module Mutant
class Mutator
class Node
class Splat < self
handle :splat
children :expression
private
# Perform dispatch
#
# @return [undefined]
#
# @api private
#
def dispatch
emit_nil
emit_expression_mutations
emit(expression)
end
end # Splat
end # Node
end # Mutator
end # Mutant

View file

@ -31,6 +31,8 @@ describe Mutant::Mutator, 'send' do
let(:mutations) do
mutations = []
mutations << 'foo'
mutations << 'foo(nil)'
mutations << 'foo(bar)'
end
it_should_behave_like 'a mutator'