ruby-changes:18924
From: sorah <ko1@a...>
Date: Thu, 24 Feb 2011 10:12:13 +0900 (JST)
Subject: [ruby-changes:18924] Ruby:r30948 (trunk): * test/testunit/tests_for_parallel/misc.rb: Fix bug in r30947.
sorah 2011-02-24 10:08:51 +0900 (Thu, 24 Feb 2011) New Revision: 30948 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30948 Log: * test/testunit/tests_for_parallel/misc.rb: Fix bug in r30947. * lib/test/unit.rb, lib/test/unit/assertions.rb: For this test. Modified files: trunk/ChangeLog trunk/lib/test/unit/testcase.rb trunk/lib/test/unit.rb trunk/test/testunit/tests_for_parallel/misc.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 30947) +++ ChangeLog (revision 30948) @@ -1,3 +1,8 @@ +Thu Feb 24 10:05:55 2011 Shota Fukumori (sora_h) <sorah@t...> + + * test/testunit/tests_for_parallel/misc.rb: Fix bug in r30947. + * lib/test/unit.rb, lib/test/unit/assertions.rb: For this test. + Wed Feb 23 23:07:38 2011 Shota Fukumori (sora_h) <sorah@t...> * test/testunit/test_parallel.rb, test/testunit/parallel/*: Index: lib/test/unit/testcase.rb =================================================================== --- lib/test/unit/testcase.rb (revision 30947) +++ lib/test/unit/testcase.rb (revision 30948) @@ -7,6 +7,12 @@ class TestCase < MiniTest::Unit::TestCase include Assertions + + def run runner + @options = runner.options + super runner + end + def self.test_order :sorted end Index: lib/test/unit.rb =================================================================== --- lib/test/unit.rb (revision 30947) +++ lib/test/unit.rb (revision 30948) @@ -32,6 +32,7 @@ module Options def initialize(*, &block) @init_hook = block + @options = nil super(&nil) end @@ -232,7 +233,12 @@ alias orig_run_anything _run_anything undef _run_anything + undef options + def options + @optss ||= (@options||{}).merge(@opts) + end + def _run_anything type if @opts[:parallel] && @warnings warn "" Index: test/testunit/tests_for_parallel/misc.rb =================================================================== --- test/testunit/tests_for_parallel/misc.rb (revision 30947) +++ test/testunit/tests_for_parallel/misc.rb (revision 30948) @@ -1,31 +1,36 @@ -module Test - module Unit - class Worker - def run_tests - _run_anything :ptest +# FIXME: more portability code +if caller(7) && /block in non_options/ =~ caller(7)[0] + class TestCaseForParallelTest < Test::Unit::TestCase;end +else + module Test + module Unit + class Worker + def run_tests + _run_anything :ptest + end end - end - class Runner - def run_tests - _run_anything :ptest + class Runner + def run_tests + _run_anything :ptest + end end end end -end -module MiniTest - class Unit - class << TestCase - alias ptest_suites test_suites - def ptest_methods;[];end + module MiniTest + class Unit + class << TestCase + alias ptest_suites test_suites + def ptest_methods;[];end + end end end -end -class TestCaseForParallelTest < Test::Unit::TestCase - class << self - undef ptest_methods - def ptest_methods - public_instance_methods(true).grep(/^ptest/).map { |m| m.to_s } + class TestCaseForParallelTest < Test::Unit::TestCase + class << self + undef ptest_methods + def ptest_methods + public_instance_methods(true).grep(/^ptest/).map { |m| m.to_s } + end end end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/