Class: TapOut::Reporters::Tap

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

Overview

Tap Reporter

Constant Summary

Constants inherited from Abstract

Abstract::INTERNALS

Instance Method Summary collapse

Methods inherited from Abstract

#<<, #clean_backtrace, #code_snippet, #err, #finish_case, #finish_suite, #handle, inherited, #initialize, #note, #omit, #parse_source_location, #skip, #source, #tally, #test

Constructor Details

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

Instance Method Details

#error(entry) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/tapout/reporters/tap.rb', line 53

def error(entry)
  super(entry)

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

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

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

#fail(entry) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/tapout/reporters/tap.rb', line 37

def fail(entry)
  super(entry)

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

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

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

#pass(entry) ⇒ Object



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

def pass(entry)
  super(entry)

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

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

#start_case(entry) ⇒ Object



18
19
20
# File 'lib/tapout/reporters/tap.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.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