2013-07-28 16:03:06 -07:00
|
|
|
# encoding: utf-8
|
|
|
|
|
2013-01-13 22:25:49 +01:00
|
|
|
module Mutant
|
|
|
|
class Subject
|
|
|
|
# Abstract base class for method subjects
|
|
|
|
class Method < self
|
|
|
|
|
|
|
|
# Test if method is public
|
|
|
|
#
|
|
|
|
# @return [true]
|
|
|
|
# if method is public
|
|
|
|
#
|
|
|
|
# @return [false]
|
|
|
|
# otherwise
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
abstract_method :public?
|
|
|
|
|
2013-06-15 16:32:40 +02:00
|
|
|
# Return method name
|
2013-06-14 20:29:36 +02:00
|
|
|
#
|
2013-06-15 16:32:40 +02:00
|
|
|
# @return [Symbol]
|
2013-06-14 20:29:36 +02:00
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2013-06-15 16:32:40 +02:00
|
|
|
def name
|
|
|
|
node.children[self.class::NAME_INDEX]
|
2013-06-14 20:29:36 +02:00
|
|
|
end
|
2013-06-14 20:23:46 +02:00
|
|
|
|
2013-06-15 16:32:40 +02:00
|
|
|
private
|
|
|
|
|
2013-07-05 00:54:50 +02:00
|
|
|
# Return mutations
|
|
|
|
#
|
2013-07-15 01:17:15 +02:00
|
|
|
# @param [#<<] emitter
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
2013-07-05 00:54:50 +02:00
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2013-07-15 01:17:15 +02:00
|
|
|
def generate_mutations(emitter)
|
|
|
|
emitter << noop_mutation
|
|
|
|
Mutator.each(node) do |mutant|
|
|
|
|
emitter << Mutation::Evil.new(self, mutant)
|
2013-07-05 00:54:50 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-06-15 16:32:40 +02:00
|
|
|
# Return scope
|
2013-01-21 23:54:25 +01:00
|
|
|
#
|
2013-06-15 16:32:40 +02:00
|
|
|
# @return [Class, Module]
|
2013-01-21 23:54:25 +01:00
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2013-06-15 16:32:40 +02:00
|
|
|
def scope
|
|
|
|
context.scope
|
2013-01-21 23:54:25 +01:00
|
|
|
end
|
|
|
|
|
2013-06-14 20:29:36 +02:00
|
|
|
# Return subtype identifier
|
2013-01-21 23:54:25 +01:00
|
|
|
#
|
2013-06-14 20:29:36 +02:00
|
|
|
# @return [String]
|
2013-01-21 23:54:25 +01:00
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2013-06-14 20:29:36 +02:00
|
|
|
def subtype
|
|
|
|
"#{context.identification}#{self.class::SYMBOL}#{name}"
|
2013-01-21 23:54:25 +01:00
|
|
|
end
|
|
|
|
|
2013-06-14 20:23:46 +02:00
|
|
|
end # Method
|
|
|
|
end # Subject
|
|
|
|
end # Mutant
|