require 'test/spec' require 'test/spec/dox' class Test::Unit::AutoRunner # :nodoc: RUNNERS[:taptap] = lambda { Test::Unit::UI::TapTap::TestRunner } end module Test::Unit::UI # :nodoc: module TapTap # :nodoc: class TestRunner < Test::Unit::UI::SpecDox::TestRunner def output_heading(heading) end def started(result) super @count = 0 end def add_fault(fault) if fault.kind_of? Test::Spec::Disabled @disabled += 1 output_no_nl "ok " @last_fault = " # SKIP disabled" else @faults << fault output_no_nl "not ok " @last_loc = fault.location.first[/(.*):in/, 1] + " - " word = fault.class.name[/(.*::)?(.*)/, 2].upcase @last_fault = " (#{word} - #{@faults.size})" end @already_outputted = true end def test_started(name) end def test_finished(name) contextname, specname = unmangle name contextname.gsub!(/\t/, ' - ') output_no_nl "ok " unless @already_outputted @count += 1 output "#{@count} - #{@last_loc}#{contextname} - #{specname}#{@last_fault}" @already_outputted = false @last_fault = @last_loc = nil end def finished(elapsed_time) output_no_nl "# " output_result output "1..#{@result.run_count}" end def indent(depth) end end end end at_exit do unless $! || Test::Unit.run? exit Test::Unit::AutoRunner.run(false, nil, ["-r", "taptap"]) end end