Class: Mutant::Reporter::CLI::Printer::Mutation Private

Inherits:
Mutant::Reporter::CLI::Printer show all
Defined in:
lib/mutant/reporter/cli/printer/mutation.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Reporter for mutations

Constant Summary collapse

NO_DIFF_MESSAGE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

<<~'MESSAGE'
  --- Internal failure ---
  BUG: A generated mutation did not result in exactly one diff hunk!
  This is an invariant violation by the mutation generation engine.
  Please report a reproduction to https://github.com/mbj/mutant
  Original unparsed source:
  %s
  Original AST:
  %s
  Mutated unparsed source:
  %s
  Mutated AST:
  %s
MESSAGE
SEPARATOR =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'-----------------------'

Constants inherited from Mutant::Reporter::CLI::Printer

NL

Instance Method Summary collapse

Methods inherited from Mutant::Reporter::CLI::Printer

#call

Methods included from Procto

included

Instance Method Details

#original_nodeObject

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.



50
51
52
# File 'lib/mutant/reporter/cli/printer/mutation.rb', line 50

def original_node
  object.subject.node
end

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.



40
41
42
43
44
45
46
47
48
# File 'lib/mutant/reporter/cli/printer/mutation.rb', line 40

def print_no_diff_message
  info(
    NO_DIFF_MESSAGE,
    object.original_source,
    original_node.inspect,
    object.source,
    object.node.inspect
  )
end

#runundefined

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.

Run report printer

Returns:

  • (undefined)


29
30
31
32
33
34
35
36
37
38
# File 'lib/mutant/reporter/cli/printer/mutation.rb', line 29

def run
  diff = object.diff
  diff = color? ? diff.colorized_diff : diff.diff

  if diff
    output.write(diff)
  else
    print_no_diff_message
  end
end