2003-09-04 21:47:41 -04:00
|
|
|
require 'test/unit/testsuite'
|
|
|
|
require 'test/unit/testcase'
|
|
|
|
require 'optparse'
|
|
|
|
|
2003-09-04 22:38:33 -04:00
|
|
|
rcsid = %w$Id$
|
2003-09-04 22:57:49 -04:00
|
|
|
Version = rcsid[2].scan(/\d+/).collect!(&method(:Integer)).freeze
|
2003-09-04 22:38:33 -04:00
|
|
|
Release = rcsid[3].freeze
|
2003-09-04 21:47:41 -04:00
|
|
|
|
|
|
|
class BulkTestSuite < Test::Unit::TestSuite
|
|
|
|
def self.suite
|
|
|
|
suite = Test::Unit::TestSuite.new
|
|
|
|
ObjectSpace.each_object(Class) do |klass|
|
|
|
|
suite << klass.suite if (Test::Unit::TestCase > klass)
|
|
|
|
end
|
|
|
|
suite
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
runners_map = {
|
|
|
|
'console' => proc do |suite|
|
|
|
|
require 'test/unit/ui/console/testrunner'
|
|
|
|
passed = Test::Unit::UI::Console::TestRunner.run(suite).passed?
|
|
|
|
exit(passed ? 0 : 1)
|
|
|
|
end,
|
|
|
|
'gtk' => proc do |suite|
|
|
|
|
require 'test/unit/ui/gtk/testrunner'
|
|
|
|
Test::Unit::UI::GTK::TestRunner.run(suite)
|
|
|
|
end,
|
|
|
|
'fox' => proc do |suite|
|
|
|
|
require 'test/unit/ui/fox/testrunner'
|
|
|
|
Test::Unit::UI::Fox::TestRunner.run(suite)
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
2003-09-04 22:32:24 -04:00
|
|
|
runner = 'console'
|
2003-09-05 11:15:43 -04:00
|
|
|
opt = OptionParser.new
|
|
|
|
opt.program_name = $0
|
|
|
|
opt.banner << " [tests...]"
|
|
|
|
opt.on("--runner=mode", runners_map.keys, "UI mode (console, gtk,fox)") do |arg|
|
|
|
|
runner = arg
|
|
|
|
end
|
|
|
|
begin
|
|
|
|
argv = opt.parse(*ARGV)
|
|
|
|
rescue OptionParser::ParseError
|
|
|
|
opt.abort($!)
|
|
|
|
end
|
2003-09-04 22:32:24 -04:00
|
|
|
|
2003-09-05 11:15:43 -04:00
|
|
|
if argv.empty?
|
|
|
|
argv = Dir.glob(File.join(File.dirname(__FILE__), "**", "test_*.rb")).sort
|
2003-09-04 22:32:24 -04:00
|
|
|
end
|
|
|
|
|
2003-09-05 11:15:43 -04:00
|
|
|
argv.each do |tc_name|
|
2003-09-04 22:32:24 -04:00
|
|
|
require tc_name
|
|
|
|
end
|
|
|
|
|
2003-09-04 21:47:41 -04:00
|
|
|
runners_map[runner].call(BulkTestSuite.suite)
|