ruby-changes:30553
From: zzak <ko1@a...>
Date: Tue, 20 Aug 2013 02:36:10 +0900 (JST)
Subject: [ruby-changes:30553] zzak:r42632 (trunk): * lib/test/: [DOC] Document Test::Unit, hide most submodules and
zzak 2013-08-20 02:36:03 +0900 (Tue, 20 Aug 2013) New Revision: 42632 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42632 Log: * lib/test/: [DOC] Document Test::Unit, hide most submodules and classes from rdoc. Since lib/test is only present as a compatibility layer with the legacy test suite many test/unit users will be using minitest or the test/unit gem instead. It is recommended to use one of these alternatives for writing new tests. This patch was based on a patch submitted by Steve Klabnik. [ruby-core:56694] [Bug #8778] Modified files: trunk/ChangeLog trunk/lib/test/unit/assertions.rb trunk/lib/test/unit/parallel.rb trunk/lib/test/unit/testcase.rb trunk/lib/test/unit.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 42631) +++ ChangeLog (revision 42632) @@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Aug 20 02:32:52 2013 Zachary Scott <e@z...> + + * lib/test/: [DOC] Document Test::Unit, hide most submodules and + classes from rdoc. Since lib/test is only present as a compatibility + layer with the legacy test suite many test/unit users will be using + minitest or the test/unit gem instead. It is recommended to use one + of these alternatives for writing new tests. + + This patch was based on a patch submitted by Steve Klabnik. + [ruby-core:56694] [Bug #8778] + Tue Aug 20 02:10:19 2013 Zachary Scott <e@z...> * lib/rss/rss.rb: [DOC] Document for constants by Steve Klabnik Index: lib/test/unit/assertions.rb =================================================================== --- lib/test/unit/assertions.rb (revision 42631) +++ lib/test/unit/assertions.rb (revision 42632) @@ -358,7 +358,7 @@ EOT https://github.com/ruby/ruby/blob/trunk/lib/test/unit/assertions.rb#L358 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") Index: lib/test/unit/testcase.rb =================================================================== --- lib/test/unit/testcase.rb (revision 42631) +++ lib/test/unit/testcase.rb (revision 42632) @@ -5,7 +5,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/lib/test/unit/testcase.rb#L5 # 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? Index: lib/test/unit/parallel.rb =================================================================== --- lib/test/unit/parallel.rb (revision 42631) +++ lib/test/unit/parallel.rb (revision 42632) @@ -2,7 +2,7 @@ require 'test/unit' https://github.com/ruby/ruby/blob/trunk/lib/test/unit/parallel.rb#L2 module Test module Unit - class Worker < Runner + class Worker < Runner # :nodoc: class << self undef autorun end @@ -12,19 +12,19 @@ module Test https://github.com/ruby/ruby/blob/trunk/lib/test/unit/parallel.rb#L12 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 https://github.com/ruby/ruby/blob/trunk/lib/test/unit/parallel.rb#L81 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 https://github.com/ruby/ruby/blob/trunk/lib/test/unit/parallel.rb#L149 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 https://github.com/ruby/ruby/blob/trunk/lib/test/unit/parallel.rb#L165 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__ https://github.com/ruby/ruby/blob/trunk/lib/test/unit/parallel.rb#L174 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 Index: lib/test/unit.rb =================================================================== --- lib/test/unit.rb (revision 42631) +++ lib/test/unit.rb (revision 42632) @@ -1,15 +1,21 @@ https://github.com/ruby/ruby/blob/trunk/lib/test/unit.rb#L1 -# 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 https://github.com/ruby/ruby/blob/trunk/lib/test/unit.rb#L35 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 https://github.com/ruby/ruby/blob/trunk/lib/test/unit.rb#L157 end end - module GlobOption + module GlobOption # :nodoc: all @@testfile_prefix = "test" def setup_options(parser, options) @@ -197,7 +203,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/lib/test/unit.rb#L203 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 https://github.com/ruby/ruby/blob/trunk/lib/test/unit.rb#L212 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 https://github.com/ruby/ruby/blob/trunk/lib/test/unit.rb#L238 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 https://github.com/ruby/ruby/blob/trunk/lib/test/unit.rb#L258 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 https://github.com/ruby/ruby/blob/trunk/lib/test/unit.rb#L765 rep end - def initialize # :nodoc: + def initialize super @tty = $stdout.tty? end @@ -777,7 +783,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/lib/test/unit.rb#L783 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 https://github.com/ruby/ruby/blob/trunk/lib/test/unit.rb#L804 end end - class AutoRunner + class AutoRunner # :nodoc: all class Runner < Test::Unit::Runner include Test::Unit::RequireFiles end @@ -839,7 +845,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/lib/test/unit.rb#L845 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 https://github.com/ruby/ruby/blob/trunk/lib/test/unit.rb#L856 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/