From e67e930462b781f09e412e161c4ed8515640bdb2 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 8 Dec 2003 13:48:14 +0000 Subject: [PATCH] * 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 --- ChangeLog | 13 +++++++++++++ lib/test/unit/autorunner.rb | 26 ++++++++++++------------- lib/test/unit/ui/console/testrunner.rb | 5 ----- lib/test/unit/ui/fox/testrunner.rb | 2 +- lib/test/unit/ui/gtk/testrunner.rb | 2 +- lib/test/unit/ui/gtk2/testrunner.rb | 2 +- lib/test/unit/ui/testrunnerutilities.rb | 5 +++++ lib/test/unit/ui/tk/testrunner.rb | 2 +- 8 files changed, 35 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 33837ca0c1..ee84e66ed1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Mon Dec 8 22:48:03 2003 Nobuyoshi Nakada + + * 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 * ext/syck/syck.c (syck_io_str_read): get rid of buffer overflow. diff --git a/lib/test/unit/autorunner.rb b/lib/test/unit/autorunner.rb index 49fe543550..76c3100472 100644 --- a/lib/test/unit/autorunner.rb +++ b/lib/test/unit/autorunner.rb @@ -1,7 +1,6 @@ +require 'test/unit/ui/testrunnerutilities' require 'optparse' -require 'test/unit/ui/console/testrunner' - module Test module Unit class AutoRunner @@ -17,31 +16,32 @@ module Test RUNNERS = { :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, :gtk => proc do |r| require 'test/unit/ui/gtk/testrunner' - Test::Unit::UI::GTK::TestRunner.run(r.suite) + Test::Unit::UI::GTK::TestRunner end, :gtk2 => proc do |r| require 'test/unit/ui/gtk2/testrunner' - Test::Unit::UI::GTK2::TestRunner.run(r.suite) + Test::Unit::UI::GTK2::TestRunner end, :fox => proc do |r| require 'test/unit/ui/fox/testrunner' - Test::Unit::UI::Fox::TestRunner.run(r.suite) + Test::Unit::UI::Fox::TestRunner end, :tk => proc do |r| require 'test/unit/ui/tk/testrunner' - Test::Unit::UI::Tk::TestRunner.run(r.suite) + Test::Unit::UI::Tk::TestRunner end, } OUTPUT_LEVELS = { - :silent => UI::Console::TestRunner::SILENT, - :progress => UI::Console::TestRunner::PROGRESS_ONLY, - :normal => UI::Console::TestRunner::NORMAL, - :verbose => UI::Console::TestRunner::VERBOSE, + :silent => UI::SILENT, + :progress => UI::PROGRESS_ONLY, + :normal => UI::NORMAL, + :verbose => UI::VERBOSE, } COLLECTORS = { @@ -71,7 +71,7 @@ module Test @collector = COLLECTORS[(standalone ? :dir : :objectspace)] @filters = [] @to_run = [] - @output_level = Test::Unit::UI::Console::TestRunner::NORMAL + @output_level = UI::NORMAL yield(self) if(block_given?) end @@ -180,7 +180,7 @@ module Test def run @suite = @collector[self] result = @runner[self] or return false - result.passed? + result.run(@suite, @output_level).passed? end end end diff --git a/lib/test/unit/ui/console/testrunner.rb b/lib/test/unit/ui/console/testrunner.rb index dab07ddbc4..761777195b 100644 --- a/lib/test/unit/ui/console/testrunner.rb +++ b/lib/test/unit/ui/console/testrunner.rb @@ -16,11 +16,6 @@ module Test class TestRunner extend TestRunnerUtilities - SILENT = 0 - PROGRESS_ONLY = 1 - NORMAL = 2 - VERBOSE = 3 - # Creates a new TestRunner and runs the suite. def self.run(suite, output_level=NORMAL) return new(suite, output_level).start diff --git a/lib/test/unit/ui/fox/testrunner.rb b/lib/test/unit/ui/fox/testrunner.rb index b3c0ce0e40..d89e8c2c87 100644 --- a/lib/test/unit/ui/fox/testrunner.rb +++ b/lib/test/unit/ui/fox/testrunner.rb @@ -34,7 +34,7 @@ module Test # Creates a new TestRunner for running the passed # suite. - def initialize(suite) + def initialize(suite, output_level = NORMAL) if (suite.respond_to?(:suite)) @suite = suite.suite else diff --git a/lib/test/unit/ui/gtk/testrunner.rb b/lib/test/unit/ui/gtk/testrunner.rb index 14fbce2573..85b873f5ff 100644 --- a/lib/test/unit/ui/gtk/testrunner.rb +++ b/lib/test/unit/ui/gtk/testrunner.rb @@ -27,7 +27,7 @@ module Test # Creates a new TestRunner for running the passed # suite. - def initialize(suite) + def initialize(suite, output_level = NORMAL) if (suite.respond_to?(:suite)) @suite = suite.suite else diff --git a/lib/test/unit/ui/gtk2/testrunner.rb b/lib/test/unit/ui/gtk2/testrunner.rb index 2978d10087..3ee6ce87bd 100644 --- a/lib/test/unit/ui/gtk2/testrunner.rb +++ b/lib/test/unit/ui/gtk2/testrunner.rb @@ -440,7 +440,7 @@ module Test @result end # def start - def initialize(suite) + def initialize(suite, output_level = NORMAL) if suite.respond_to?(:suite) then @suite = suite.suite else diff --git a/lib/test/unit/ui/testrunnerutilities.rb b/lib/test/unit/ui/testrunnerutilities.rb index 69811608c2..4c3148b8be 100644 --- a/lib/test/unit/ui/testrunnerutilities.rb +++ b/lib/test/unit/ui/testrunnerutilities.rb @@ -8,6 +8,11 @@ module Test module Unit module UI + SILENT = 0 + PROGRESS_ONLY = 1 + NORMAL = 2 + VERBOSE = 3 + # Provides some utilities common to most, if not all, # TestRunners. # diff --git a/lib/test/unit/ui/tk/testrunner.rb b/lib/test/unit/ui/tk/testrunner.rb index 9e444ca9ac..2bd51deebb 100644 --- a/lib/test/unit/ui/tk/testrunner.rb +++ b/lib/test/unit/ui/tk/testrunner.rb @@ -28,7 +28,7 @@ module Test # Creates a new TestRunner for running the passed # suite. - def initialize(suite) + def initialize(suite, output_level = NORMAL) if (suite.respond_to?(:suite)) @suite = suite.suite else