Class: Mutant::Reporter::CLI
- Inherits:
-
Mutant::Reporter
- Object
- Mutant::Reporter
- Mutant::Reporter::CLI
- Defined in:
- lib/mutant/reporter/cli.rb
Overview
Reporter that reports in human readable format
Instance Attribute Summary collapse
-
#io ⇒ IO
readonly
private
Return IO stream.
-
#stats ⇒ Stats
readonly
private
Return stats.
Instance Method Summary collapse
-
#config(config) ⇒ self
private
Report config.
-
#error_stream ⇒ IO
private
Return error stream.
-
#errors(errors) ⇒ self
private
Report errors.
-
#killer(killer) ⇒ self
private
Reporter killer.
-
#mutation(mutation) ⇒ self
private
Report mutation.
-
#noop(killer) ⇒ self
private
Report noop.
-
#output_stream ⇒ IO
private
Return output stream.
-
#subject(subject) ⇒ self
private
Reporter subject.
Methods inherited from Mutant::Reporter
Instance Attribute Details
#io ⇒ IO (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return IO stream
153 154 155 |
# File 'lib/mutant/reporter/cli.rb', line 153 def io @io end |
#stats ⇒ Stats (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return stats
161 162 163 |
# File 'lib/mutant/reporter/cli.rb', line 161 def stats @stats end |
Instance Method Details
#config(config) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Report config
64 65 66 67 68 69 |
# File 'lib/mutant/reporter/cli.rb', line 64 def config(config) puts 'Mutant configuration:' puts "Matcher: #{config.matcher.inspect}" puts "Filter: #{config.filter.inspect}" puts "Strategy: #{config.strategy.inspect}" end |
#error_stream ⇒ IO
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return error stream
26 27 28 |
# File 'lib/mutant/reporter/cli.rb', line 26 def error_stream @config.debug? ? io : StringIO.new end |
#errors(errors) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Report errors
132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/mutant/reporter/cli.rb', line 132 def errors(errors) errors.each do |error| failure(error) end puts puts "subjects: #{stats.subjects}" puts "mutations: #{stats.mutations}" puts "noop_fails: #{stats.noop_fails}" puts "kills: #{stats.kills}" puts "alive: #{stats.alive}" puts "mtime: %02.2fs" % stats.time puts "rtime: %02.2fs" % stats.runtime end |
#killer(killer) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Reporter killer
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/mutant/reporter/cli.rb', line 105 def killer(killer) stats.killer(killer) color, word = if killer.fail? [Color::RED, 'Alive'] else [Color::GREEN, 'Killed'] end print_killer(color, word, killer) if killer.fail? colorized_diff(killer.mutation) end self end |
#mutation(mutation) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Report mutation
48 49 50 51 52 53 54 |
# File 'lib/mutant/reporter/cli.rb', line 48 def mutation(mutation) if @config.debug? colorized_diff(mutation) end self end |
#noop(killer) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Report noop
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/mutant/reporter/cli.rb', line 79 def noop(killer) color, word = if killer.fail? [Color::GREEN, 'Alive'] else [Color::RED, 'Killed'] end print_killer(color, word, killer) unless killer.fail? puts(killer.mutation.source) stats.noop_fail(killer) end self end |
#output_stream ⇒ IO
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return output stream
36 37 38 |
# File 'lib/mutant/reporter/cli.rb', line 36 def output_stream @config.debug? ? io : StringIO.new end |
#subject(subject) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Reporter subject
15 16 17 18 |
# File 'lib/mutant/reporter/cli.rb', line 15 def subject(subject) stats.subject puts("Subject: #{subject.identification}") end |