Skip to content

Commit

Permalink
Add explicit mutator for blockarg
Browse files Browse the repository at this point in the history
  • Loading branch information
dkubb committed Sep 9, 2013
1 parent 74b7ae9 commit ce91c93
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/mutant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ module Mutant
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'
Expand Down
15 changes: 15 additions & 0 deletions lib/mutant/mutator/node/blockarg.rb
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion lib/mutant/mutator/node/generic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class Generic < self
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,
Expand Down
17 changes: 17 additions & 0 deletions spec/unit/mutant/mutator/node/blockarg/mutation_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ce91c93

Please sign in to comment.