Use child nameing in while mutator and fix edge cases
This commit is contained in:
parent
47b539c3fd
commit
79e8cd2b9c
2 changed files with 6 additions and 4 deletions
|
@ -9,6 +9,8 @@ module Mutant
|
|||
|
||||
CONDITION_INDEX, BODY_INDEX = 0, 1
|
||||
|
||||
children :condition, :body
|
||||
|
||||
private
|
||||
|
||||
# Emit mutations
|
||||
|
@ -18,8 +20,8 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def dispatch
|
||||
mutate_child(CONDITION_INDEX)
|
||||
mutate_child(BODY_INDEX)
|
||||
emit_condition_mutations
|
||||
emit_body_mutations
|
||||
end
|
||||
|
||||
end # While
|
||||
|
|
|
@ -9,9 +9,9 @@ describe Mutant::Mutator::Node::While do
|
|||
mutations = []
|
||||
mutations << 'while true; bar; end'
|
||||
mutations << 'while true; foo; end'
|
||||
mutations << 'while true; nil; end'
|
||||
mutations << 'while true; end'
|
||||
mutations << 'while false; foo; bar; end'
|
||||
mutations << 'while nil; foo; bar; end'
|
||||
mutations << 'while nil; foo; bar; end'
|
||||
end
|
||||
|
||||
it_should_behave_like 'a mutator'
|
||||
|
|
Loading…
Reference in a new issue