From 83ad5d4557dacdd8f32f20f263e8a8c875277872 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 5 Sep 2003 02:32:24 +0000 Subject: * lib/optparse.rb (--version): fix assignment/reference order. * lib/optparse.rb (OptionParser#help): new; OptionParser#to_s may be deprecated in future. * lib/optparse/version.rb (OptionParser#show_version): hide Object. * test/runner.rb: fix optparse usage. * test/runner.rb: glob all testsuits if no tests given. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/runner.rb | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/runner.rb b/test/runner.rb index bae7116ea..d8b981743 100644 --- a/test/runner.rb +++ b/test/runner.rb @@ -2,16 +2,9 @@ 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 +Revision = %w$Revision$[1..-1] +(Runner = Revision[0]).chomp!(",v") +Version = Revision[1].scan(/\d+/, &method(:Integer)) class BulkTestSuite < Test::Unit::TestSuite def self.suite @@ -39,4 +32,22 @@ runners_map = { end, } +runner = 'console' +ARGV.options do |opt| + opt.program_name = Runner + opt.banner << " [tests...]" + opt.on("--runner=mode", runners_map, "UI mode (console, gtk,fox)") do |arg| + runner = arg + end + opt.parse! +end or abort(ARGV.options.help) + +if ARGV.empty? + ARGV.replace(Dir.glob(File.join(File.dirname(__FILE__), "**", "test_*.rb")).sort) +end + +ARGV.each do |tc_name| + require tc_name +end + runners_map[runner].call(BulkTestSuite.suite) -- cgit