2012-12-06 15:30:28 -05:00
|
|
|
module Mutant
|
|
|
|
class Mutator
|
|
|
|
class Node
|
|
|
|
# Mutator on AST blocks
|
|
|
|
class Block < self
|
|
|
|
|
2013-06-04 04:25:13 -04:00
|
|
|
handle(:block)
|
2012-12-06 15:30:28 -05:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
# Emit mutants
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def dispatch
|
|
|
|
array = input.array
|
2012-12-12 16:31:14 -05:00
|
|
|
emit_attribute_mutations(:array) do |mutation|
|
|
|
|
array = mutation.array
|
|
|
|
# Do not generate empty bodies
|
|
|
|
if array.empty?
|
|
|
|
array << new_nil
|
|
|
|
end
|
2013-01-09 14:43:06 -05:00
|
|
|
mutation
|
2012-12-07 17:27:21 -05:00
|
|
|
end
|
|
|
|
end
|
2012-12-12 16:31:14 -05:00
|
|
|
|
2013-06-04 04:25:13 -04:00
|
|
|
end # Block
|
|
|
|
end # Node
|
|
|
|
end # Mutator
|
|
|
|
end # Mutant
|