Merge pull request #112 from mbj/blockarg-mutator
Add explicit mutator for blockarg
This commit is contained in:
commit
8988cfabcd
4 changed files with 33 additions and 1 deletions
|
@ -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'
|
||||
|
|
15
lib/mutant/mutator/node/blockarg.rb
Normal file
15
lib/mutant/mutator/node/blockarg.rb
Normal file
|
@ -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
|
|
@ -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,
|
||||
|
|
17
spec/unit/mutant/mutator/node/blockarg/mutation_spec.rb
Normal file
17
spec/unit/mutant/mutator/node/blockarg/mutation_spec.rb
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue