class Test::Unit::UI::Tap::PerlTestRunner
Outputs test results in traditional TAP format, version 12.
Public Instance Methods
tapout_after_suite(time)
click to toggle source
# File lib/test/unit/ui/tap/perl_testrunner.rb, line 76 def tapout_after_suite(time) puts("# Finished in #{time} seconds.") @result.to_s.each_line do |line| puts("# #{line}") end end
tapout_before_suite(suite)
click to toggle source
Calls superclass method
Test::Unit::UI::Tap::BaseTestRunner#tapout_before_suite
# File lib/test/unit/ui/tap/perl_testrunner.rb, line 14 def tapout_before_suite(suite) doc = super(suite) @i = 0 puts "1..#{doc['count']}" end
tapout_error(fault)
click to toggle source
Calls superclass method
Test::Unit::UI::Tap::BaseTestRunner#tapout_error
# File lib/test/unit/ui/tap/perl_testrunner.rb, line 40 def tapout_error(fault) doc = super(fault) if doc @i += 1 puts "not ok #{@i} - #{doc['label']}(#{@test_case.name})" puts subdata(doc, 'ERROR') end end
tapout_fail(fault)
click to toggle source
Calls superclass method
Test::Unit::UI::Tap::BaseTestRunner#tapout_fail
# File lib/test/unit/ui/tap/perl_testrunner.rb, line 30 def tapout_fail(fault) doc = super(fault) if doc @i += 1 puts "not ok #{@i} - #{doc['label']}(#{@test_case.name})" puts subdata(doc, 'FAIL') end end
tapout_note(note)
click to toggle source
Calls superclass method
Test::Unit::UI::Tap::BaseTestRunner#tapout_note
# File lib/test/unit/ui/tap/perl_testrunner.rb, line 70 def tapout_note(note) doc = super(note) puts '# ' + doc['text'].gsub("\n", "\n# ") end
tapout_omit(fault)
click to toggle source
Calls superclass method
Test::Unit::UI::Tap::BaseTestRunner#tapout_omit
# File lib/test/unit/ui/tap/perl_testrunner.rb, line 50 def tapout_omit(fault) doc = super(fault) if doc @i += 1 puts "not ok #{@i} - #{doc['label']}(#{@test_case.name}) # SKIP" puts subdata(doc, 'SKIP') end end
tapout_pass(test)
click to toggle source
Calls superclass method
Test::Unit::UI::Tap::BaseTestRunner#tapout_pass
# File lib/test/unit/ui/tap/perl_testrunner.rb, line 21 def tapout_pass(test) doc = super(test) if doc @i += 1 puts "ok #{@i} - #{doc['label']}(#{@test_case.name})" end end
tapout_todo(fault)
click to toggle source
Calls superclass method
Test::Unit::UI::Tap::BaseTestRunner#tapout_todo
# File lib/test/unit/ui/tap/perl_testrunner.rb, line 60 def tapout_todo(fault) doc = super(fault) if doc @i += 1 puts "not ok #{@i} - #{doc['label']}(#{@test_case.name}) # TODO" puts subdata(doc, 'TODO') end end
Private Instance Methods
subdata(doc, type)
click to toggle source
# File lib/test/unit/ui/tap/perl_testrunner.rb, line 88 def subdata(doc, type) exp = doc['exception'] exp_class = exp['class'] message = exp['message'] backtrace = exp['backtrace'] file = exp['file'] line = exp['line'] body = [] body << "%s (%s)" % [type, exp_class] body << message.to_s backtrace[0..0].each do |bt| body << bt.to_s end code_snippet_string(file, line).each_line do |s| body << s.chomp end backtrace[1..-1].each do |bt| body << bt.to_s end body = body.join("\n").gsub(/^/, '# ') end