Add static fail and success strategies

* Useful for benchmarking
This commit is contained in:
Markus Schirp 2012-11-22 03:00:36 +01:00
parent 6c8d519ec5
commit fb8bb2ed24
4 changed files with 41 additions and 9 deletions

View file

@ -83,6 +83,7 @@ require 'mutant/matcher/method/instance'
require 'mutant/matcher/method/classifier'
require 'mutant/matcher/scope_methods'
require 'mutant/killer'
require 'mutant/killer/static'
require 'mutant/killer/rspec'
require 'mutant/killer/forking'
require 'mutant/strategy'

View file

@ -83,15 +83,17 @@ module Mutant
private
OPTIONS = {
'--code' => [:add_filter, Mutation::Filter::Code ],
'-I' => [:add_load_path ],
'--include' => [:add_load_path ],
'-r' => [:require_library ],
'--require' => [:require_library ],
#'--killer-fork' => [:enable_killer_fork ],
'--rspec-unit' => [:set_strategy, Strategy::Rspec::Unit ],
'--rspec-full' => [:set_strategy, Strategy::Rspec::Full ],
'--rspec-dm2' => [:set_strategy, Strategy::Rspec::DM2 ]
'--code' => [:add_filter, Mutation::Filter::Code ],
'-I' => [:add_load_path ],
'--include' => [:add_load_path ],
'-r' => [:require_library ],
'--require' => [:require_library ],
#'--killer-fork' => [:enable_killer_fork ],
'--rspec-unit' => [:set_strategy, Strategy::Rspec::Unit ],
'--rspec-full' => [:set_strategy, Strategy::Rspec::Full ],
'--rspec-dm2' => [:set_strategy, Strategy::Rspec::DM2 ],
'--static-fail' => [:set_strategy, Strategy::Static::Fail ],
'--static-success' => [:set_strategy, Strategy::Static::Success ]
}.deep_freeze
OPTION_PATTERN = %r(\A-(?:-)?[a-zA-Z0-9\-]+\z).freeze

View file

@ -0,0 +1,19 @@
module Mutant
class Killer
class Static < self
def run
self.class::RESULT
end
class Success < self
TYPE = 'success'.freeze
RESULT = true
end
class Fail < self
TYPE = 'fail'.freeze
RESULT = false
end
end
end
end

View file

@ -18,6 +18,16 @@ module Mutant
self::KILLER
end
class Static < self
class Fail < self
KILLER = Killer::Static::Fail
end
class Success < self
KILLER = Killer::Static::Success
end
end
class Rspec < self
KILLER = Killer::Rspec