Bug #6882 » test.diff
| lib/test/unit/parallel.rb (作業コピー) | ||
|---|---|---|
|       end
 | ||
|  | ||
|       def puke(klass, meth, e)
 | ||
|         @partial_report << [klass.name, meth, e]
 | ||
|         @partial_report << [klass.name, meth, e.is_a?(MiniTest::Assertion) ? e : ProxyError.new(e)]
 | ||
|         super
 | ||
|       end
 | ||
|     end
 | ||
| lib/test/unit.rb (作業コピー) | ||
|---|---|---|
|         new(*args).run
 | ||
|       end
 | ||
|     end
 | ||
|  | ||
|     class ProxyError < StandardError
 | ||
|       def initialize(ex)
 | ||
|         @message = ex.message
 | ||
|         @backtrace = ex.backtrace
 | ||
|       end
 | ||
|  | ||
|       attr_accessor :message, :backtrace
 | ||
|     end
 | ||
|   end
 | ||
| end
 | ||
|  | ||
| test/testunit/tests_for_parallel/ptest_forth.rb (作業コピー) | ||
|---|---|---|
| require 'test/unit'
 | ||
|  | ||
| class TestE < Test::Unit::TestCase
 | ||
|   class UnknownError < RuntimeError; end
 | ||
|  | ||
|   def test_not_fail
 | ||
|     assert_equal(1,1)
 | ||
|   end
 | ||
| ... | ... | |
|   def test_always_fail
 | ||
|     assert_equal(0,1)
 | ||
|   end
 | ||
| end
 | ||
|  | ||
|   def test_unknown_error
 | ||
|     raise UnknownError, "unknown error"
 | ||
|   end
 | ||
| end
 | ||
| test/testunit/test_parallel.rb (作業コピー) | ||
|---|---|---|
|       timeout(10) do
 | ||
|         @worker_in.puts "run #{TESTS}/ptest_forth.rb test"
 | ||
|         i = 0
 | ||
|         5.times { @worker_out.gets }
 | ||
|         6.times { @worker_out.gets }
 | ||
|         buf = @worker_out.gets
 | ||
|         assert_match(/^done (.+?)$/, buf)
 | ||
|  | ||
| ... | ... | |
|  | ||
|         result = Marshal.load($1.chomp.unpack("m")[0])
 | ||
|  | ||
|         assert_equal(result[0],3)
 | ||
|         assert_equal(result[1],2)
 | ||
|         assert_equal(4, result[0])
 | ||
|         assert_equal(2, result[1])
 | ||
|         assert_kind_of(Array,result[2])
 | ||
|         assert_kind_of(Array,result[3])
 | ||
|         assert_kind_of(Array,result[4])
 | ||
|         assert_kind_of(Array,result[2][1])
 | ||
|         assert_kind_of(MiniTest::Assertion,result[2][0][2])
 | ||
|         assert_kind_of(MiniTest::Skip,result[2][1][2])
 | ||
|         assert_kind_of(Exception, result[2][2][2])
 | ||
|         assert_equal(result[5], "TestE")
 | ||
|       end
 | ||
|     end
 | ||
| ... | ... | |
|     def test_should_run_all_without_any_leaks
 | ||
|       spawn_runner
 | ||
|       buf = timeout(10){@test_out.read}
 | ||
|       assert_match(/^[SF\.]{7}$/,buf)
 | ||
|       assert_match(/^[SFE\.]{8}$/,buf)
 | ||
|     end
 | ||
|  | ||
|     def test_should_retry_failed_on_workers
 | ||