From 09d2946061379d18407d4de2002a01f3a82c8c84 Mon Sep 17 00:00:00 2001 From: ntalbott Date: Wed, 8 Oct 2003 13:21:28 +0000 Subject: * lib/test/unit.rb: removed installation instructions. * lib/test/unit/ui/testrunnermediator.rb: moved the run flag to a more central location. * lib/test/unit.rb: ditto. * lib/test/unit.rb: extracted the running code in to AutoRunner. * lib/test/unit/autorunner.rb: added. * lib/test/unit/collector/objectspace.rb: extracted common test collection functionality in to a module. * lib/test/unit/collector.rb: ditto; added. * test/testunit/collector/test_objectspace.rb: ditto. * lib/test/unit/collector/dir.rb: added. Supports collecting tests out of a directory structure. * test/testunit/collector/test_dir.rb: added. * test/runner.rb: simplified to use the new capabilities. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/runner.rb | 60 ++-------------------------------------------------------- 1 file changed, 2 insertions(+), 58 deletions(-) (limited to 'test/runner.rb') diff --git a/test/runner.rb b/test/runner.rb index b0a63a31ce..b2841b012a 100644 --- a/test/runner.rb +++ b/test/runner.rb @@ -1,63 +1,7 @@ -require 'test/unit/testsuite' -require 'test/unit/testcase' -require 'optparse' +require 'test/unit' rcsid = %w$Id$ Version = rcsid[2].scan(/\d+/).collect!(&method(:Integer)).freeze Release = rcsid[3].freeze -class BulkTestSuite < Test::Unit::TestSuite - def self.suite - suite = Test::Unit::TestSuite.new(self.name) - 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, -} - -runner = 'console' -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 - -if argv.empty? - argv = [File.dirname(__FILE__)] -end -argv.collect! do |arg| - if File.directory?(arg) - Dir.glob(File.join(arg, "**", "test_*.rb")).sort - else - arg - end -end.flatten! - -argv.each do |tc_name| - require tc_name -end - -runners_map[runner].call(BulkTestSuite.suite) +Test::Unit::AutoRunner.run(false, File.dirname(__FILE__)) -- cgit v1.2.3