summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/test/unit.rb41
-rw-r--r--lib/test/unit/assertions.rb2
-rw-r--r--lib/test/unit/parallel.rb20
-rw-r--r--lib/test/unit/testcase.rb2
4 files changed, 39 insertions, 26 deletions
diff --git a/lib/test/unit.rb b/lib/test/unit.rb
index b96dece837..9c12a44bb7 100644
--- a/lib/test/unit.rb
+++ b/lib/test/unit.rb
@@ -1,15 +1,21 @@
-# test/unit compatibility layer using minitest.
-
require 'minitest/unit'
require 'test/unit/assertions'
require 'test/unit/testcase'
require 'optparse'
+# See Test::Unit
module Test
+ ##
+ # Test::Unit is an implementation of the xUnit testing framework for Ruby.
+ #
+ # If you are writing new test code, please use MiniTest instead of Test::Unit.
+ #
+ # Test::Unit has been left in the standard library to support legacy test
+ # suites.
module Unit
- TEST_UNIT_IMPLEMENTATION = 'test/unit compatibility layer using minitest'
+ TEST_UNIT_IMPLEMENTATION = 'test/unit compatibility layer using minitest' # :nodoc:
- module RunCount
+ module RunCount # :nodoc: all
@@run_count = 0
def self.have_run?
@@ -29,7 +35,7 @@ module Test
module_function :run_once
end
- module Options
+ module Options # :nodoc: all
def initialize(*, &block)
@init_hook = block
@options = nil
@@ -151,7 +157,7 @@ module Test
end
end
- module GlobOption
+ module GlobOption # :nodoc: all
@@testfile_prefix = "test"
def setup_options(parser, options)
@@ -197,7 +203,7 @@ module Test
end
end
- module LoadPathOption
+ module LoadPathOption # :nodoc: all
def setup_options(parser, options)
super
parser.on '-Idirectory', 'Add library load path' do |dirs|
@@ -206,7 +212,7 @@ module Test
end
end
- module GCStressOption
+ module GCStressOption # :nodoc: all
def setup_options(parser, options)
super
parser.on '--[no-]gc-stress', 'Set GC.stress as true' do |flag|
@@ -232,7 +238,7 @@ module Test
end
end
- module RequireFiles
+ module RequireFiles # :nodoc: all
def non_options(files, options)
return false if !super
result = false
@@ -252,7 +258,7 @@ module Test
end
end
- class Runner < MiniTest::Unit
+ class Runner < MiniTest::Unit # :nodoc: all
include Test::Unit::Options
include Test::Unit::GlobOption
include Test::Unit::LoadPathOption
@@ -759,7 +765,7 @@ module Test
rep
end
- def initialize # :nodoc:
+ def initialize
super
@tty = $stdout.tty?
end
@@ -777,7 +783,7 @@ module Test
end
end
- class StatusLineOutput < Struct.new(:runner)
+ class StatusLineOutput < Struct.new(:runner) # :nodoc: all
def puts(*a) $stdout.puts(*a) unless a.empty? end
def respond_to_missing?(*a) $stdout.respond_to?(*a) end
def method_missing(*a, &b) $stdout.__send__(*a, &b) end
@@ -798,7 +804,7 @@ module Test
end
end
- class AutoRunner
+ class AutoRunner # :nodoc: all
class Runner < Test::Unit::Runner
include Test::Unit::RequireFiles
end
@@ -839,7 +845,7 @@ module Test
end
end
- class ProxyError < StandardError
+ class ProxyError < StandardError # :nodoc: all
def initialize(ex)
@message = ex.message
@backtrace = ex.backtrace
@@ -850,7 +856,12 @@ module Test
end
end
-class MiniTest::Unit::TestCase
+module MiniTest # :nodoc: all
+ module Unit
+ end
+end
+
+class MiniTest::Unit::TestCase # :nodoc: all
undef run_test
RUN_TEST_TRACE = "#{__FILE__}:#{__LINE__+3}:in `run_test'".freeze
def run_test(name)
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb
index bc8530e3f6..3d8a698b0d 100644
--- a/lib/test/unit/assertions.rb
+++ b/lib/test/unit/assertions.rb
@@ -358,7 +358,7 @@ EOT
template.gsub(/\G((?:[^\\]|\\.)*?)(\\)?\?/) { $1 + ($2 ? "?" : mu_pp(arguments.shift)) }
end
- def message(msg = nil, *args, &default)
+ def message(msg = nil, *args, &default) # :nodoc:
if Proc === msg
super(nil, *args) do
[msg.call, (default.call if default)].compact.reject(&:empty?).join(".\n")
diff --git a/lib/test/unit/parallel.rb b/lib/test/unit/parallel.rb
index d1891838f7..c1ecf29263 100644
--- a/lib/test/unit/parallel.rb
+++ b/lib/test/unit/parallel.rb
@@ -2,7 +2,7 @@ require 'test/unit'
module Test
module Unit
- class Worker < Runner
+ class Worker < Runner # :nodoc:
class << self
undef autorun
end
@@ -12,19 +12,19 @@ module Test
undef _run_suites
undef run
- def increment_io(orig)
+ def increment_io(orig) # :nodoc:
*rest, io = 32.times.inject([orig.dup]){|ios, | ios << ios.last.dup }
rest.each(&:close)
io
end
- def _run_suites(suites, type)
+ def _run_suites(suites, type) # :nodoc:
suites.map do |suite|
_run_suite(suite, type)
end
end
- def _run_suite(suite, type)
+ def _run_suite(suite, type) # :nodoc:
@partial_report = []
orig_testout = MiniTest::Unit.output
i,o = IO.pipe
@@ -81,7 +81,7 @@ module Test
i.close if i && !i.closed?
end
- def run(args = [])
+ def run(args = []) # :nodoc:
process_args args
@@stop_auto_run = true
@opts = @options.dup
@@ -149,12 +149,12 @@ module Test
end
end
- def _report(res, *args)
+ def _report(res, *args) # :nodoc:
res = "#{res} #{args.pack("m0")}" unless args.empty?
@stdout.puts(res)
end
- def puke(klass, meth, e)
+ def puke(klass, meth, e) # :nodoc:
@partial_report << [klass.name, meth, e.is_a?(MiniTest::Assertion) ? e : ProxyError.new(e)]
super
end
@@ -165,7 +165,7 @@ end
if $0 == __FILE__
module Test
module Unit
- class TestCase < MiniTest::Unit::TestCase
+ class TestCase < MiniTest::Unit::TestCase # :nodoc: all
undef on_parallel_worker?
def on_parallel_worker?
true
@@ -174,7 +174,9 @@ if $0 == __FILE__
end
end
require 'rubygems'
- class Gem::TestCase < MiniTest::Unit::TestCase
+ module Gem # :nodoc:
+ end
+ class Gem::TestCase < MiniTest::Unit::TestCase # :nodoc:
@@project_dir = File.expand_path('../../../..', __FILE__)
end
diff --git a/lib/test/unit/testcase.rb b/lib/test/unit/testcase.rb
index 59637e1234..984f08dd32 100644
--- a/lib/test/unit/testcase.rb
+++ b/lib/test/unit/testcase.rb
@@ -5,7 +5,7 @@ module Test
# remove silly TestCase class
remove_const(:TestCase) if defined?(self::TestCase)
- class TestCase < MiniTest::Unit::TestCase
+ class TestCase < MiniTest::Unit::TestCase # :nodoc: all
include Assertions
def on_parallel_worker?