1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/runner.rb
nahi e45738a297 * test/runner.rb: added. gets testcases from command line and runs it.
* test/ruby/test_gc.rb: remove useless part which was for dumping test result.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-05 01:47:41 +00:00

42 lines
971 B
Ruby

require 'test/unit/testsuite'
require 'test/unit/testcase'
require 'optparse'
runner = 'console'
opt = OptionParser.new
opt.on("--runner=console", String) do |arg|
runner = arg
end
opt.parse!(ARGV)
ARGV.each do |tc_name|
require tc_name
end
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,
}
runners_map[runner].call(BulkTestSuite.suite)