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