Class: QED::Reporter::Verbatim

Inherits:
BaseClass show all
Defined in:
lib/qed/reporter/verbatim.rb

Overview

Verbatim Reporter

Constant Summary

Constants inherited from BaseClass

BaseClass::ANSICode

Instance Attribute Summary

Attributes inherited from BaseClass

#error, #fail, #io, #pass, #steps

Instance Method Summary collapse

Methods inherited from BaseClass

#initialize, #report_end, #report_intro, #report_omit, #report_start, #report_step, #report_summary

Constructor Details

This class inherits a constructor from QED::Reporter::BaseClass

Instance Method Details

#report_comment(step) ⇒ Object



28
29
30
31
# File 'lib/qed/reporter/verbatim.rb', line 28

def report_comment(step)
  io.puts step
  #io.puts
end

#report_error(step, error) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/qed/reporter/verbatim.rb', line 58

def report_error(step, error)
  raise error if $DEBUG
  tab = step.to_s.index(/\S/) #step.tab
  io.puts ANSICode.red("#{step}")
  #io.puts
  msg = []
  msg << ANSICode.bold(ANSICode.red("ERROR: ")) + error.to_str.sub(/for QED::Context.*?$/,'')
  msg << ANSICode.bold(error.backtrace[0].chomp(":in \`_binding'"))
  #msg = ANSICode.red(msg)
  io.puts msg.join("\n").tabto(tab||2)
  io.puts
end

#report_fail(step, error) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/qed/reporter/verbatim.rb', line 47

def report_fail(step, error)
  tab = step.to_s.index(/\S/) #step.tab
  io.puts ANSICode.red("#{step}")
  #puts
  msg = []
  msg << ANSICode.bold(ANSICode.red("FAIL: ")) + error.to_str
  msg << ANSICode.bold(error.backtrace[0].chomp(":in \`_binding'"))
  io.puts msg.join("\n").tabto(tab||2)
  io.puts
end

#report_header(step) ⇒ Object

def report_step(step)

super
if step.code
  #str = "(%s) %s" % [count.join('.'), str.tab(6).strip]
  #io.puts "* #{step.to_s.tab(2).strip}"
  #io.puts
  #io.puts step.to_s
  #io.puts
else
  #io.puts "#{step}\n"  # TODO: This never happens.
end

end



23
24
25
26
# File 'lib/qed/reporter/verbatim.rb', line 23

def report_header(step)
  io.puts ANSICode.bold("#{step}")
  #io.puts
end

#report_macro(step) ⇒ Object



34
35
36
37
38
39
# File 'lib/qed/reporter/verbatim.rb', line 34

def report_macro(step)
  #io.puts
  #io.puts step.text
  io.puts ANSICode.magenta("#{step}")
  #io.puts
end

#report_pass(step) ⇒ Object



42
43
44
45
# File 'lib/qed/reporter/verbatim.rb', line 42

def report_pass(step)
  io.puts ANSICode.green("#{step}")
  #io.puts
end

#report_step_end(step) ⇒ Object



71
72
73
# File 'lib/qed/reporter/verbatim.rb', line 71

def report_step_end(step)
  io.puts
end