Class: Evilution::Reporter::CLI::ItemFormatters::CoverageGap

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/reporter/cli/item_formatters/coverage_gap.rb

Instance Method Summary collapse

Instance Method Details

#format(gap) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/evilution/reporter/cli/item_formatters/coverage_gap.rb', line 6

def format(gap)
  location = "#{gap.file_path}:#{gap.line}"
  header = if gap.single?
             "  #{gap.primary_operator}: #{location} (#{gap.subject_name})"
           else
             operators = gap.operator_names.join(", ")
             "  #{location} (#{gap.subject_name}) [#{gap.count} mutations: #{operators}]"
           end
  body = gap.mutation_results.first.mutation.unified_diff || gap.primary_diff
  indented = body.split("\n").map { |l| "    #{l}" }.join("\n")
  "#{header}\n#{indented}"
end