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

root/tags/RELEASE_1_5_0/test/runner.rb

Revision 932, 1.4 kB (checked in by nahi, 5 years ago)

Run with UTF8.

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