~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to lib/test/unit/ui/testrunnerutilities.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#--
 
2
#
 
3
# Author:: Nathaniel Talbott.
 
4
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
 
5
# License:: Ruby license.
 
6
 
 
7
module Test
 
8
  module Unit
 
9
    module UI
 
10
 
 
11
      SILENT = 0
 
12
      PROGRESS_ONLY = 1
 
13
      NORMAL = 2
 
14
      VERBOSE = 3
 
15
 
 
16
      # Provides some utilities common to most, if not all,
 
17
      # TestRunners.
 
18
      #
 
19
      #--
 
20
      #
 
21
      # Perhaps there ought to be a TestRunner superclass? There
 
22
      # seems to be a decent amount of shared code between test
 
23
      # runners.
 
24
 
 
25
      module TestRunnerUtilities
 
26
 
 
27
        # Creates a new TestRunner and runs the suite.
 
28
        def run(suite, output_level=NORMAL)
 
29
          return new(suite, output_level).start
 
30
        end
 
31
 
 
32
        # Takes care of the ARGV parsing and suite
 
33
        # determination necessary for running one of the
 
34
        # TestRunners from the command line.
 
35
        def start_command_line_test
 
36
          if ARGV.empty?
 
37
            puts "You should supply the name of a test suite file to the runner"
 
38
            exit
 
39
          end
 
40
          require ARGV[0].gsub(/.+::/, '')
 
41
          new(eval(ARGV[0])).start
 
42
        end
 
43
      end
 
44
    end
 
45
  end
 
46
end