Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

root/tags/RELEASE_1_5_1/test/runner.rb

Revision 1033, 1.4 kB (checked in by anonymous, 5 years ago)

This commit was manufactured by cvs2svn to create tag
'RELEASE_1_5_1'.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to author date id revision
Line 
1 require 'test/unit/testsuite'
2 require 'test/unit/testcase'
3 require 'optparse'
4
5 rcsid = %w$Id: runner.rb,v 1.3 2003/10/04 08:42:13 nahi Exp $
6 Version = rcsid[2].scan(/\d+/).collect!(&method(:Integer)).freeze
7 Release = rcsid[3].freeze
8
9 class BulkTestSuite < Test::Unit::TestSuite
10   def self.suite
11     suite = Test::Unit::TestSuite.new(self.name)
12     ObjectSpace.each_object(Class) do |klass|
13       suite << klass.suite if (Test::Unit::TestCase > klass)
14     end
15     suite
16   end
17 end
18
19 runners_map = {
20   'console' => proc do |suite|
21     require 'test/unit/ui/console/testrunner'
22     passed = Test::Unit::UI::Console::TestRunner.run(suite).passed?
23     exit(passed ? 0 : 1)
24   end,
25   'gtk' => proc do |suite|
26     require 'test/unit/ui/gtk/testrunner'
27     Test::Unit::UI::GTK::TestRunner.run(suite)
28   end,
29   'fox' => proc do |suite|
30     require 'test/unit/ui/fox/testrunner'
31     Test::Unit::UI::Fox::TestRunner.run(suite)
32   end,
33 }
34
35 runner = 'console'
36 opt = OptionParser.new
37 opt.program_name = $0
38 opt.banner << " [tests...]"
39 opt.on("--runner=mode", runners_map.keys, "UI mode (console, gtk,fox)") do |arg|
40   runner = arg
41 end
42 begin
43   argv = opt.parse(*ARGV)
44 rescue OptionParser::ParseError
45   opt.abort($!)
46 end
47
48 if argv.empty?
49   argv = [File.dirname(__FILE__)]
50 end
51 argv.collect! do |arg|
52   if File.directory?(arg)
53     Dir.glob(File.join(arg, "**", "test_*.rb")).sort
54   else
55     arg
56   end
57 end.flatten!
58
59 argv.each do |tc_name|
60   require tc_name
61 end
62
63 runners_map[runner].call(BulkTestSuite.suite)
Note: See TracBrowser for help on using the browser.