diff --git a/lib/mutant.rb b/lib/mutant.rb index 82ba6a35..38e71762 100644 --- a/lib/mutant.rb +++ b/lib/mutant.rb @@ -61,6 +61,7 @@ require 'mutant/mutator/node/literal/regex' require 'mutant/mutator/node/literal/nil' require 'mutant/mutator/node/argument' require 'mutant/mutator/node/arguments' +require 'mutant/mutator/node/blockarg' require 'mutant/mutator/node/begin' require 'mutant/mutator/node/connective/binary' require 'mutant/mutator/node/const' diff --git a/lib/mutant/mutator/node/blockarg.rb b/lib/mutant/mutator/node/blockarg.rb new file mode 100644 index 00000000..9f3810f6 --- /dev/null +++ b/lib/mutant/mutator/node/blockarg.rb @@ -0,0 +1,15 @@ +# encoding: utf-8 + +module Mutant + class Mutator + class Node + + # Blockarg mutator + class Blockarg < Generic + + handle(:blockarg) + + end # Blockarg + end # Node + end # Mutator +end # Mutant diff --git a/lib/mutant/mutator/node/generic.rb b/lib/mutant/mutator/node/generic.rb index 9bb30923..b8c9c26c 100644 --- a/lib/mutant/mutator/node/generic.rb +++ b/lib/mutant/mutator/node/generic.rb @@ -12,7 +12,6 @@ module Mutant handle( :next, :break, :ensure, :yield, :rescue, :redo, :defined?, - :blockarg, :regopt, :resbody, :retry, :arg_expr, :kwrestarg, :kwoptarg, :kwarg, :undef, :module, :empty, :alias, :for, :xstr, :back_ref, :class, diff --git a/spec/unit/mutant/mutator/node/blockarg/mutation_spec.rb b/spec/unit/mutant/mutator/node/blockarg/mutation_spec.rb new file mode 100644 index 00000000..0412f4ae --- /dev/null +++ b/spec/unit/mutant/mutator/node/blockarg/mutation_spec.rb @@ -0,0 +1,17 @@ +# encoding: utf-8 + +require 'spec_helper' + +describe Mutant::Mutator::Node::Blockarg, 'blockarg' do + let(:source) { 'foo { |&bar| }' } + + let(:mutations) do + mutations = [] + mutations << 'foo { |&bar| raise }' + mutations << 'foo {}' + mutations << 'foo' + mutations << 'nil' + end + + it_should_behave_like 'a mutator' +end