free_mutant/mutation-test.rb
Markus Schirp 459d028de1 Add a working mutation tester for mutant
* Expand attr_reader :name, to def name; @name; end
  As attr_reader defined methods do not have a valid source location.
* Expose more internal state to allow the generation of nice match
  identifications. Needs to be cleaned up.
2012-08-20 17:53:41 +02:00

33 lines
681 B
Ruby

$: << 'lib'
require 'mutant'
require 'rspec'
require './spec/support/zombie'
Zombie.setup
class MutantKiller < Zombie::Killer::Rspec
def filename_pattern
subject = mutation.subject
matcher = subject.matcher
context = subject.context
path = context.scope.name.split('::').map do |name|
name.downcase
end.join('/')
"spec/unit/#{path}"
#case matcher
#when Zombie::Matcher::Method::Singleton
#when Zombie::Matcher::Method::Instance
#else
# raise "Unkown matcher: #{matcher.class}"
#end
end
end
Zombie::Runner.run(
:killer => MutantKiller,
:pattern => /\AMutant(::|\z)/,
:reporter => Zombie::Reporter::CLI.new($stderr)
)