Class: Test::Reporters::Tap

Inherits:
Abstract
  • Object
show all
Defined in:
lib/rubytest/format/tap.rb

Overview

Classic TAP Reporter

This reporter conforms to v12 of TAP. It could do with some imporvements yet, and eventually upgraded to v13 of standard.

Instance Method Summary collapse

Instance Method Details

#begin_suite(suite) ⇒ Object


12
13
14
15
16
17
# File 'lib/rubytest/format/tap.rb', line 12

def begin_suite(suite)
  @start_time = Time.now
  @i = 0
  @n = total_count(suite)
  puts "1..#{@n}"
end

#begin_test(test) ⇒ Object


19
20
21
# File 'lib/rubytest/format/tap.rb', line 19

def begin_test(test)
  @i += 1
end

#error(test, exception) ⇒ Object


37
38
39
40
41
42
# File 'lib/rubytest/format/tap.rb', line 37

def error(test, exception)
  puts "not ok #{@i} - #{test}"
  puts "  ERROR #{exception.class}"
  puts "  #{exception}"
  puts "  " + clean_backtrace(exception).join("\n        ")
end

#fail(test, exception) ⇒ Object


29
30
31
32
33
34
# File 'lib/rubytest/format/tap.rb', line 29

def fail(test, exception)
  puts "not ok #{@i} - #{test}"
  puts "  FAIL #{exception.class}"
  puts "  #{exception}"
  puts "  #{clean_backtrace(exception)[0]}"
end

#omit(test, exception) ⇒ Object


52
53
54
55
56
# File 'lib/rubytest/format/tap.rb', line 52

def omit(test, exception)
  puts "ok #{@i} - #{test}"
  puts "  OMIT"
  puts "  #{clean_backtrace(exception)[1]}"
end

#pass(test) ⇒ Object


24
25
26
# File 'lib/rubytest/format/tap.rb', line 24

def pass(test)
  puts "ok #{@i} - #{test}"
end

#todo(test, exception) ⇒ Object


45
46
47
48
49
# File 'lib/rubytest/format/tap.rb', line 45

def todo(test, exception)
  puts "not ok #{@i} - #{test}"
  puts "  PENDING"
  puts "  #{clean_backtrace(exception)[1]}"
end