lib/mutest/mutator/node/arguments.rb in mutest-0.0.9 vs lib/mutest/mutator/node/arguments.rb in mutest-0.0.10
- old
+ new
@@ -20,22 +20,35 @@
# Emit argument presence mutation
#
# @return [undefined]
def emit_argument_presence
emit_type
+
mutate_with(Util::Array::Presence, children) do |children|
- emit_type(*children)
+ if children.one? && n_mlhs?(Mutest::Util.one(children))
+ emit_procarg(Mutest::Util.one(children))
+ else
+ emit_type(*children)
+ end
end
end
+ # Emit procarg form
+ #
+ # @return [undefined]
+ def emit_procarg(arg)
+ emit_type(s(:procarg0, *arg))
+ end
+
# Emit argument mutations
#
# @return [undefined]
def emit_argument_mutations
children.each_with_index do |child, index|
mutate(child).each do |mutest|
next if invalid_argument_replacement?(mutest, index)
+
emit_child_update(index, mutest)
end
end
end
@@ -82,9 +95,9 @@
def mlhs_childs_with_index
children.each_with_index.select do |child, _index|
n_mlhs?(child)
end
end
- end # Arguments
- end # Node
- end # Mutator
-end # Mutest
+ end
+ end
+ end
+end