mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/test/unit/autorunner.rb: remove dependency to a particular
runner. [ruby-core:01901], [ruby-list:38869] * lib/test/unit/ui/testrunnerutilities.rb: moved output level constants from Console. * lib/test/unit/ui/console/testrunner.rb: ditto. * lib/test/unit/ui/{fox,gtk,gtk2,tk}/testrunner.rb (initialize): accept output_level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3fb4d657d8
commit
e67e930462
8 changed files with 35 additions and 22 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
Mon Dec 8 22:48:03 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/test/unit/autorunner.rb: remove dependency to a particular
|
||||||
|
runner. [ruby-core:01901], [ruby-list:38869]
|
||||||
|
|
||||||
|
* lib/test/unit/ui/testrunnerutilities.rb: moved output level
|
||||||
|
constants from Console.
|
||||||
|
|
||||||
|
* lib/test/unit/ui/console/testrunner.rb: ditto.
|
||||||
|
|
||||||
|
* lib/test/unit/ui/{fox,gtk,gtk2,tk}/testrunner.rb (initialize):
|
||||||
|
accept output_level.
|
||||||
|
|
||||||
Mon Dec 8 15:03:30 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Dec 8 15:03:30 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/syck/syck.c (syck_io_str_read): get rid of buffer overflow.
|
* ext/syck/syck.c (syck_io_str_read): get rid of buffer overflow.
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
|
require 'test/unit/ui/testrunnerutilities'
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
|
|
||||||
require 'test/unit/ui/console/testrunner'
|
|
||||||
|
|
||||||
module Test
|
module Test
|
||||||
module Unit
|
module Unit
|
||||||
class AutoRunner
|
class AutoRunner
|
||||||
|
@ -17,31 +16,32 @@ module Test
|
||||||
|
|
||||||
RUNNERS = {
|
RUNNERS = {
|
||||||
:console => proc do |r|
|
:console => proc do |r|
|
||||||
Test::Unit::UI::Console::TestRunner.run(r.suite, r.output_level)
|
require 'test/unit/ui/console/testrunner'
|
||||||
|
Test::Unit::UI::Console::TestRunner
|
||||||
end,
|
end,
|
||||||
:gtk => proc do |r|
|
:gtk => proc do |r|
|
||||||
require 'test/unit/ui/gtk/testrunner'
|
require 'test/unit/ui/gtk/testrunner'
|
||||||
Test::Unit::UI::GTK::TestRunner.run(r.suite)
|
Test::Unit::UI::GTK::TestRunner
|
||||||
end,
|
end,
|
||||||
:gtk2 => proc do |r|
|
:gtk2 => proc do |r|
|
||||||
require 'test/unit/ui/gtk2/testrunner'
|
require 'test/unit/ui/gtk2/testrunner'
|
||||||
Test::Unit::UI::GTK2::TestRunner.run(r.suite)
|
Test::Unit::UI::GTK2::TestRunner
|
||||||
end,
|
end,
|
||||||
:fox => proc do |r|
|
:fox => proc do |r|
|
||||||
require 'test/unit/ui/fox/testrunner'
|
require 'test/unit/ui/fox/testrunner'
|
||||||
Test::Unit::UI::Fox::TestRunner.run(r.suite)
|
Test::Unit::UI::Fox::TestRunner
|
||||||
end,
|
end,
|
||||||
:tk => proc do |r|
|
:tk => proc do |r|
|
||||||
require 'test/unit/ui/tk/testrunner'
|
require 'test/unit/ui/tk/testrunner'
|
||||||
Test::Unit::UI::Tk::TestRunner.run(r.suite)
|
Test::Unit::UI::Tk::TestRunner
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
OUTPUT_LEVELS = {
|
OUTPUT_LEVELS = {
|
||||||
:silent => UI::Console::TestRunner::SILENT,
|
:silent => UI::SILENT,
|
||||||
:progress => UI::Console::TestRunner::PROGRESS_ONLY,
|
:progress => UI::PROGRESS_ONLY,
|
||||||
:normal => UI::Console::TestRunner::NORMAL,
|
:normal => UI::NORMAL,
|
||||||
:verbose => UI::Console::TestRunner::VERBOSE,
|
:verbose => UI::VERBOSE,
|
||||||
}
|
}
|
||||||
|
|
||||||
COLLECTORS = {
|
COLLECTORS = {
|
||||||
|
@ -71,7 +71,7 @@ module Test
|
||||||
@collector = COLLECTORS[(standalone ? :dir : :objectspace)]
|
@collector = COLLECTORS[(standalone ? :dir : :objectspace)]
|
||||||
@filters = []
|
@filters = []
|
||||||
@to_run = []
|
@to_run = []
|
||||||
@output_level = Test::Unit::UI::Console::TestRunner::NORMAL
|
@output_level = UI::NORMAL
|
||||||
yield(self) if(block_given?)
|
yield(self) if(block_given?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ module Test
|
||||||
def run
|
def run
|
||||||
@suite = @collector[self]
|
@suite = @collector[self]
|
||||||
result = @runner[self] or return false
|
result = @runner[self] or return false
|
||||||
result.passed?
|
result.run(@suite, @output_level).passed?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,11 +16,6 @@ module Test
|
||||||
class TestRunner
|
class TestRunner
|
||||||
extend TestRunnerUtilities
|
extend TestRunnerUtilities
|
||||||
|
|
||||||
SILENT = 0
|
|
||||||
PROGRESS_ONLY = 1
|
|
||||||
NORMAL = 2
|
|
||||||
VERBOSE = 3
|
|
||||||
|
|
||||||
# Creates a new TestRunner and runs the suite.
|
# Creates a new TestRunner and runs the suite.
|
||||||
def self.run(suite, output_level=NORMAL)
|
def self.run(suite, output_level=NORMAL)
|
||||||
return new(suite, output_level).start
|
return new(suite, output_level).start
|
||||||
|
|
|
@ -34,7 +34,7 @@ module Test
|
||||||
|
|
||||||
# Creates a new TestRunner for running the passed
|
# Creates a new TestRunner for running the passed
|
||||||
# suite.
|
# suite.
|
||||||
def initialize(suite)
|
def initialize(suite, output_level = NORMAL)
|
||||||
if (suite.respond_to?(:suite))
|
if (suite.respond_to?(:suite))
|
||||||
@suite = suite.suite
|
@suite = suite.suite
|
||||||
else
|
else
|
||||||
|
|
|
@ -27,7 +27,7 @@ module Test
|
||||||
|
|
||||||
# Creates a new TestRunner for running the passed
|
# Creates a new TestRunner for running the passed
|
||||||
# suite.
|
# suite.
|
||||||
def initialize(suite)
|
def initialize(suite, output_level = NORMAL)
|
||||||
if (suite.respond_to?(:suite))
|
if (suite.respond_to?(:suite))
|
||||||
@suite = suite.suite
|
@suite = suite.suite
|
||||||
else
|
else
|
||||||
|
|
|
@ -440,7 +440,7 @@ module Test
|
||||||
@result
|
@result
|
||||||
end # def start
|
end # def start
|
||||||
|
|
||||||
def initialize(suite)
|
def initialize(suite, output_level = NORMAL)
|
||||||
if suite.respond_to?(:suite) then
|
if suite.respond_to?(:suite) then
|
||||||
@suite = suite.suite
|
@suite = suite.suite
|
||||||
else
|
else
|
||||||
|
|
|
@ -8,6 +8,11 @@ module Test
|
||||||
module Unit
|
module Unit
|
||||||
module UI
|
module UI
|
||||||
|
|
||||||
|
SILENT = 0
|
||||||
|
PROGRESS_ONLY = 1
|
||||||
|
NORMAL = 2
|
||||||
|
VERBOSE = 3
|
||||||
|
|
||||||
# Provides some utilities common to most, if not all,
|
# Provides some utilities common to most, if not all,
|
||||||
# TestRunners.
|
# TestRunners.
|
||||||
#
|
#
|
||||||
|
|
|
@ -28,7 +28,7 @@ module Test
|
||||||
|
|
||||||
# Creates a new TestRunner for running the passed
|
# Creates a new TestRunner for running the passed
|
||||||
# suite.
|
# suite.
|
||||||
def initialize(suite)
|
def initialize(suite, output_level = NORMAL)
|
||||||
if (suite.respond_to?(:suite))
|
if (suite.respond_to?(:suite))
|
||||||
@suite = suite.suite
|
@suite = suite.suite
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue