Add mutator for zsuper node
This commit is contained in:
parent
86eaa57331
commit
e85bdfa0e9
4 changed files with 33 additions and 2 deletions
|
@ -62,6 +62,7 @@ require 'mutant/mutator/node/named_value/constant_assignment'
|
|||
require 'mutant/mutator/node/named_value/variable_assignment'
|
||||
require 'mutant/mutator/node/while'
|
||||
require 'mutant/mutator/node/super'
|
||||
require 'mutant/mutator/node/zsuper'
|
||||
require 'mutant/mutator/node/send'
|
||||
require 'mutant/mutator/node/send/binary'
|
||||
require 'mutant/mutator/node/when'
|
||||
|
|
|
@ -8,7 +8,7 @@ module Mutant
|
|||
# These nodes still need a dedicated mutator,
|
||||
# your contribution is that close!
|
||||
handle(
|
||||
:zsuper, :not, :or, :and, :defined,
|
||||
:not, :or, :and, :defined,
|
||||
:next, :break, :match, :ensure,
|
||||
:dstr, :dsym, :yield, :rescue, :redo, :defined?,
|
||||
:blockarg, :block_pass, :op_asgn, :and_asgn,
|
||||
|
|
25
lib/mutant/mutator/node/zsuper.rb
Normal file
25
lib/mutant/mutator/node/zsuper.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
module Mutant
|
||||
class Mutator
|
||||
class Node
|
||||
|
||||
# Mutator for super without parentheses
|
||||
class ZSuper < self
|
||||
|
||||
handle(:zsuper)
|
||||
|
||||
private
|
||||
|
||||
# Emit mutations
|
||||
#
|
||||
# @return [undefined]
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
def dispatch
|
||||
emit_nil
|
||||
end
|
||||
|
||||
end # ZSuper
|
||||
end # Node
|
||||
end # Mutator
|
||||
end # Mutant
|
|
@ -5,7 +5,12 @@ describe Mutant::Mutator, 'super' do
|
|||
context 'with no arguments' do
|
||||
let(:source) { 'super' }
|
||||
|
||||
it_should_behave_like 'a noop mutator'
|
||||
let(:mutations) do
|
||||
mutations = []
|
||||
mutations << 'nil'
|
||||
end
|
||||
|
||||
it_should_behave_like 'a mutator'
|
||||
end
|
||||
|
||||
context 'with explicit empty arguments' do
|
||||
|
|
Loading…
Add table
Reference in a new issue