Report test selection on progress report

This commit is contained in:
Markus Schirp 2014-05-27 14:42:15 +00:00
parent e9faba8043
commit ec85651901
10 changed files with 43 additions and 35 deletions

View file

@ -1,3 +1,3 @@
---
threshold: 18
total_score: 794
total_score: 798

View file

@ -6,6 +6,8 @@ module Mutant
# Abstract base class for process printers
class Progress < Printer
include AbstractType, Registry.new
delegate :running?
end # Progress
end # CLI
end # Reporter

View file

@ -5,9 +5,9 @@ module Mutant
# Progress printer for configuration
class Config < self
handle(Mutant::Config)
handle(Mutant::Runner::Config)
delegate :matcher, :strategy, :expected_coverage
delegate :config
# Report configuration
#
@ -18,10 +18,12 @@ module Mutant
# @api private
#
def run
info 'Mutant configuration:'
info 'Matcher: %s', matcher.inspect
info 'Strategy: %s', strategy.inspect
info 'Expect Coverage: %02f%%', expected_coverage.inspect
if running?
info 'Mutant configuration:'
info 'Matcher: %s', config.matcher.inspect
info 'Strategy: %s', config.strategy.inspect
info 'Expect Coverage: %02f%%', config.expected_coverage.inspect
end
self
end

View file

@ -13,12 +13,15 @@ module Mutant
# Run printer
#
# @return [undefined]
# @return [self]
#
# @api private
#
def run
char(success? ? SUCCESS : FAILURE)
unless running?
char(success? ? SUCCESS : FAILURE)
end
self
end
private

View file

@ -5,7 +5,7 @@ module Mutant
# Noop CLI progress reporter
class Noop < self
handle(Mutant::Mutation)
handle(Mutant::Runner::Killer)
# Noop progress report
#

View file

@ -2,30 +2,15 @@ module Mutant
class Reporter
class CLI
class Progress
# Subject results printer
class Subject < self
handle(Mutant::Subject)
# Run subject results printer
#
# @return [undefined]
#
# @api private
#
def run
puts(object.identification)
end
end # Subject
# Reporter for subject runners
class SubjectRunner < self
class Subject < self
FORMAT = '(%02d/%02d) %3d%% - %0.02fs'.freeze
handle(Mutant::Runner::Subject)
delegate :running?, :tests, :subject
# Run printer
#
# @return [undefined]
@ -33,8 +18,15 @@ module Mutant
# @api private
#
def run
print_progress_bar_finish
print_stats
if running?
puts(subject.identification)
tests.each do |test|
puts "- #{test.identification}"
end
else
print_progress_bar_finish
print_stats
end
self
end

View file

@ -53,6 +53,16 @@ module Mutant
handler.new(config, object, *arguments)
end
# Test if runner is running
#
# Yeah this is evil. Should be refactored away
#
# @return [Boolean]
#
def running?
@running
end
# Return config
#
# @return [Mutant::Config]
@ -73,7 +83,11 @@ module Mutant
@config = config
@stop = false
@start = Time.now
@running = true
progress(self)
run
@running = false
progress(self)
@end = Time.now
end

View file

@ -134,7 +134,6 @@ module Mutant
# @api private
#
def run
progress(config)
run_subjects
@end = Time.now
reporter.report(self)

View file

@ -63,14 +63,12 @@ module Mutant
# @api private
#
def run
progress(mutation)
@killers = @tests.map do |test|
Mutant::Killer.new(
mutation: mutation,
test: test
)
end.map(&method(:visit))
progress(self)
end
end # Mutation

View file

@ -83,9 +83,7 @@ module Mutant
# @api private
#
def run
progress(subject)
@mutations = visit_collection(subject.mutations, tests)
progress(self)
end
end # Subject