Skip to content

Commit

Permalink
* lib/test/unit/autorunner.rb: remove dependency to a particular
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
nobu committed Dec 8, 2003
1 parent 3fb4d65 commit e67e930
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 22 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Mon Dec 8 22:48:03 2003 Nobuyoshi Nakada <[email protected]>

* 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 <[email protected]>

* ext/syck/syck.c (syck_io_str_read): get rid of buffer overflow.
Expand Down
26 changes: 13 additions & 13 deletions lib/test/unit/autorunner.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'test/unit/ui/testrunnerutilities'
require 'optparse'

require 'test/unit/ui/console/testrunner'

module Test
module Unit
class AutoRunner
Expand All @@ -17,31 +16,32 @@ def self.run(current_file=nil, default_dir=nil, argv=ARGV, &block)

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 = {
Expand Down Expand Up @@ -71,7 +71,7 @@ def initialize(standalone)
@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

Expand Down Expand Up @@ -180,7 +180,7 @@ def keyword_display(array)
def run
@suite = @collector[self]
result = @runner[self] or return false
result.passed?
result.run(@suite, @output_level).passed?
end
end
end
Expand Down
5 changes: 0 additions & 5 deletions lib/test/unit/ui/console/testrunner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ module Console # :nodoc:
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
Expand Down
2 changes: 1 addition & 1 deletion lib/test/unit/ui/fox/testrunner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def self.run(suite)

# 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
Expand Down
2 changes: 1 addition & 1 deletion lib/test/unit/ui/gtk/testrunner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def self.run(suite)

# 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
Expand Down
2 changes: 1 addition & 1 deletion lib/test/unit/ui/gtk2/testrunner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def start
@result
end # def start

def initialize(suite)
def initialize(suite, output_level = NORMAL)
if suite.respond_to?(:suite) then
@suite = suite.suite
else
Expand Down
5 changes: 5 additions & 0 deletions lib/test/unit/ui/testrunnerutilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/test/unit/ui/tk/testrunner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def self.run(suite)

# 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
Expand Down

0 comments on commit e67e930

Please sign in to comment.