2012-11-21 18:10:50 -05:00
|
|
|
module Mutant
|
|
|
|
class Strategy
|
2012-11-26 05:30:00 -05:00
|
|
|
include AbstractType
|
2012-11-21 18:10:50 -05:00
|
|
|
|
|
|
|
# Kill mutation
|
|
|
|
#
|
|
|
|
# @param [Mutation]
|
|
|
|
#
|
|
|
|
# @return [Killer]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def self.kill(mutation)
|
|
|
|
killer.new(self, mutation)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.killer
|
2012-11-21 20:08:42 -05:00
|
|
|
self::KILLER
|
2012-11-21 18:10:50 -05:00
|
|
|
end
|
|
|
|
|
2012-11-21 21:00:36 -05:00
|
|
|
class Static < self
|
|
|
|
class Fail < self
|
|
|
|
KILLER = Killer::Static::Fail
|
|
|
|
end
|
|
|
|
|
|
|
|
class Success < self
|
|
|
|
KILLER = Killer::Static::Success
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-11-21 18:10:50 -05:00
|
|
|
class Rspec < self
|
2012-12-04 12:23:56 -05:00
|
|
|
|
2012-12-04 13:38:58 -05:00
|
|
|
KILLER = Killer::Forking.new(Killer::Rspec)
|
2012-11-21 18:10:50 -05:00
|
|
|
|
|
|
|
class DM2 < self
|
|
|
|
|
|
|
|
def self.filename_pattern(mutation)
|
2012-12-04 13:38:58 -05:00
|
|
|
subject = mutation.subject
|
|
|
|
name = subject.context.scope.name
|
|
|
|
|
|
|
|
matcher = subject.matcher
|
2012-11-21 18:10:50 -05:00
|
|
|
|
2012-12-04 13:38:58 -05:00
|
|
|
append = matcher.kind_of?(Matcher::Method::Singleton) ? '/class_methods' : ''
|
2012-11-21 18:10:50 -05:00
|
|
|
|
|
|
|
path = Inflector.underscore(name)
|
|
|
|
|
2012-12-04 13:38:58 -05:00
|
|
|
base = "spec/unit/#{path}#{append}"
|
|
|
|
|
|
|
|
"#{base}/#{matcher.method_name}_spec.rb"
|
2012-11-21 18:10:50 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class Unit < self
|
|
|
|
def self.filename_pattern(mutation)
|
2012-11-21 18:14:13 -05:00
|
|
|
'spec/unit/**/*_spec.rb'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Full < self
|
|
|
|
def self.filename_pattern(mutation)
|
|
|
|
'spec/**/*_spec.rb'
|
2012-11-21 18:10:50 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|