Add cbase mutator
This commit is contained in:
parent
345b67144a
commit
14133fe199
4 changed files with 44 additions and 1 deletions
|
@ -57,6 +57,7 @@ require 'mutant/mutator/node/literal/nil'
|
||||||
require 'mutant/mutator/node/argument'
|
require 'mutant/mutator/node/argument'
|
||||||
require 'mutant/mutator/node/arguments'
|
require 'mutant/mutator/node/arguments'
|
||||||
require 'mutant/mutator/node/begin'
|
require 'mutant/mutator/node/begin'
|
||||||
|
require 'mutant/mutator/node/cbase'
|
||||||
require 'mutant/mutator/node/const'
|
require 'mutant/mutator/node/const'
|
||||||
require 'mutant/mutator/node/named_value/access'
|
require 'mutant/mutator/node/named_value/access'
|
||||||
require 'mutant/mutator/node/named_value/constant_assignment'
|
require 'mutant/mutator/node/named_value/constant_assignment'
|
||||||
|
|
25
lib/mutant/mutator/node/cbase.rb
Normal file
25
lib/mutant/mutator/node/cbase.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
module Mutant
|
||||||
|
class Mutator
|
||||||
|
class Node
|
||||||
|
|
||||||
|
# Mutation emitter to handle cbase nodes
|
||||||
|
class Cbase < self
|
||||||
|
|
||||||
|
handle(:cbase)
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# Emit mutations
|
||||||
|
#
|
||||||
|
# @return [undefined]
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
|
#
|
||||||
|
def dispatch
|
||||||
|
# noop, for now
|
||||||
|
end
|
||||||
|
|
||||||
|
end # Cbase
|
||||||
|
end # Node
|
||||||
|
end # Mutator
|
||||||
|
end # Mutant
|
|
@ -13,7 +13,7 @@ module Mutant
|
||||||
:dstr, :dsym, :yield, :rescue, :redo, :defined?,
|
:dstr, :dsym, :yield, :rescue, :redo, :defined?,
|
||||||
:blockarg, :block_pass, :op_asgn, :and_asgn,
|
:blockarg, :block_pass, :op_asgn, :and_asgn,
|
||||||
:regopt, :restarg, :resbody, :retry, :arg_expr,
|
:regopt, :restarg, :resbody, :retry, :arg_expr,
|
||||||
:kwrestarg, :kwoptarg, :kwarg, :undef, :module, :cbase, :empty,
|
:kwrestarg, :kwoptarg, :kwarg, :undef, :module, :empty,
|
||||||
:alias, :for, :xstr, :back_ref, :nth_ref, :class,
|
:alias, :for, :xstr, :back_ref, :nth_ref, :class,
|
||||||
:sclass, :match_with_lvasgn, :match_current_line, :or_asgn, :kwbegin
|
:sclass, :match_with_lvasgn, :match_current_line, :or_asgn, :kwbegin
|
||||||
)
|
)
|
||||||
|
|
17
spec/unit/mutant/mutator/node/cbase/mutation_spec.rb
Normal file
17
spec/unit/mutant/mutator/node/cbase/mutation_spec.rb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Mutant::Mutator::Node::NamedValue::Access, 'cbase' do
|
||||||
|
|
||||||
|
before do
|
||||||
|
Mutant::Random.stub(:hex_string => :random)
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:source) { '::A' }
|
||||||
|
|
||||||
|
let(:mutations) do
|
||||||
|
mutants = []
|
||||||
|
mutants << 'nil'
|
||||||
|
end
|
||||||
|
|
||||||
|
it_should_behave_like 'a mutator'
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue