Class: Tapout::Reporters::TapReporter

Inherits:
Abstract
  • Object
show all
Defined in:
lib/tapout/reporters/tap_reporter.rb

Overview

Tap Reporter

Constant Summary

Constants inherited from Abstract

Abstract::INTERNALS

Instance Method Summary collapse

Methods inherited from Abstract

#<<, #backtrace, #backtrace_snippets, #backtrace_snippets_chain, #captured_output, #captured_output?, #captured_stderr, #captured_stderr?, #captured_stdout, #captured_stdout?, #clean_backtrace, #code_snippet, #complete_cases, #config, #count_tally, #duration, #exit_code, #finalize, #finish_case, #finish_suite, #finish_test, #format_snippet_array, #handle, inherited, #initialize, #note, #omit, #parse_backtrace, #parse_source_location, #source, #start_test, #tally, #tally_message, #time_tally, #todo

Constructor Details

This class inherits a constructor from Tapout::Reporters::Abstract

Instance Method Details

#error(entry) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/tapout/reporters/tap_reporter.rb', line 57

def error(entry)
  super(entry)

  @i += 1
  x = entry['exception']

  #desc = ok.concern.label + " #{ok.arguments.inspect}"

  body = []
  body << "ERROR #{x['file']}:#{x['line']}" #clean_backtrace(exception.backtrace)[0..2].join("    \n")
  body << "#{x['class']}: #{x['message']}"
  #body << "#{x['message']}"
  body << ""
  body << code_snippet(entry)
  body << ""
  body = body.join("\n").gsub(/^/, '  # ')

  puts "not ok #{@i} - #{entry['label']}"
  puts body
end

#fail(entry) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/tapout/reporters/tap_reporter.rb', line 38

def fail(entry)
  super(entry)

  @i += 1
  x = entry['exception']

  #desc = #ok.concern.label + " #{ok.arguments.inspect}"

  body = []
  body << "FAIL #{x['file']}:#{x['line']}" #clean_backtrace(exception.backtrace)[0]
  body << "#{x['message']}"
  body << code_snippet(entry)
  body = body.join("\n").gsub(/^/, '  # ')

  puts "not ok #{@i} - #{entry['label']}"
  puts body
end

#pass(entry) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/tapout/reporters/tap_reporter.rb', line 28

def pass(entry)
  super(entry)

  @i += 1
  #desc = entry['message'] #+ " #{ok.arguments.inspect}"

  puts "ok #{@i} - #{entry['label']}"
end

#start_case(entry) ⇒ Object



18
19
20
# File 'lib/tapout/reporters/tap_reporter.rb', line 18

def start_case(entry)
  #$stdout.puts concern.label.ansi(:bold)
end

#start_suite(entry) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/tapout/reporters/tap_reporter.rb', line 9

def start_suite(entry)
  @start = Time.now
  @i = 0
  #n = 0
  #suite.concerns.each{ |f| f.concerns.each { |s| n += s.ok.size } }
  puts "1..#{entry['count']}"
end