Sha256: c09df484e8a04ef720e720998d46e95b4de2470d06d93c847b5c4c85b1e14024

Contents?: true

Size: 1.75 KB

Versions: 7

Compression:

Stored size: 1.75 KB

Contents

module Mutant
  class Reporter
    class CLI
      class Printer
        # Reporter for subject progress
        class SubjectProgress < self
          FORMAT = '(%02d/%02d) %3d%% - killtime: %0.02fs runtime: %0.02fs overhead: %0.02fs'.freeze

          delegate(
            :tests,
            :subject,
            :coverage,
            :runtime,
            :amount_mutations_killed,
            :amount_mutations,
            :amount_mutation_results,
            :killtime,
            :overhead
          )

          # Run printer
          #
          # @return [undefined]
          #
          # @api private
          def run
            puts("#{subject.identification} mutations: #{amount_mutations}")
            print_mutation_results
            print_progress_bar_finish
            print_stats
          end

        private

          # Print stats
          #
          # @return [undefined]
          #
          # @api private
          def print_stats
            status(
              FORMAT,
              amount_mutations_killed,
              amount_mutations,
              coverage * 100,
              killtime,
              runtime,
              overhead
            )
          end

          # Print progress bar finish
          #
          # @return [undefined]
          #
          # @api private
          def print_progress_bar_finish
            puts(nil) unless amount_mutation_results.zero?
          end

          # Print mutation results
          #
          # @return [undefined]
          #
          # @api private
          def print_mutation_results
            visit_collection(MutationProgressResult, object.mutation_results)
          end
        end # SubjectProgress
      end # Printer
    end # CLI
  end # Reporter
end # Mutant

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mutant-0.8.8 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.7 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.6 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.5 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.4 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.3 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.2 lib/mutant/reporter/cli/printer/subject_progress.rb