Project

General

Profile

Bug #6882 » test.diff

usa (Usaku NAKAMURA), 08/16/2012 04:54 PM

View differences:

lib/test/unit/parallel.rb (作業コピー)
152 152
      end
153 153

  
154 154
      def puke(klass, meth, e)
155
        @partial_report << [klass.name, meth, e]
155
        @partial_report << [klass.name, meth, e.is_a?(MiniTest::Assertion) ? e : ProxyError.new(e)]
156 156
        super
157 157
      end
158 158
    end
lib/test/unit.rb (作業コピー)
828 828
        new(*args).run
829 829
      end
830 830
    end
831

  
832
    class ProxyError < StandardError
833
      def initialize(ex)
834
        @message = ex.message
835
        @backtrace = ex.backtrace
836
      end
837

  
838
      attr_accessor :message, :backtrace
839
    end
831 840
  end
832 841
end
833 842

  
test/testunit/tests_for_parallel/ptest_forth.rb (作業コピー)
1 1
require 'test/unit'
2 2

  
3 3
class TestE < Test::Unit::TestCase
4
  class UnknownError < RuntimeError; end
5

  
4 6
  def test_not_fail
5 7
    assert_equal(1,1)
6 8
  end
......
12 14
  def test_always_fail
13 15
    assert_equal(0,1)
14 16
  end
15
end
16 17

  
18
  def test_unknown_error
19
    raise UnknownError, "unknown error"
20
  end
21
end
test/testunit/test_parallel.rb (作業コピー)
91 91
      timeout(10) do
92 92
        @worker_in.puts "run #{TESTS}/ptest_forth.rb test"
93 93
        i = 0
94
        5.times { @worker_out.gets }
94
        6.times { @worker_out.gets }
95 95
        buf = @worker_out.gets
96 96
        assert_match(/^done (.+?)$/, buf)
97 97

  
......
99 99

  
100 100
        result = Marshal.load($1.chomp.unpack("m")[0])
101 101

  
102
        assert_equal(result[0],3)
103
        assert_equal(result[1],2)
102
        assert_equal(4, result[0])
103
        assert_equal(2, result[1])
104 104
        assert_kind_of(Array,result[2])
105 105
        assert_kind_of(Array,result[3])
106 106
        assert_kind_of(Array,result[4])
107 107
        assert_kind_of(Array,result[2][1])
108 108
        assert_kind_of(MiniTest::Assertion,result[2][0][2])
109 109
        assert_kind_of(MiniTest::Skip,result[2][1][2])
110
        assert_kind_of(Exception, result[2][2][2])
110 111
        assert_equal(result[5], "TestE")
111 112
      end
112 113
    end
......
156 157
    def test_should_run_all_without_any_leaks
157 158
      spawn_runner
158 159
      buf = timeout(10){@test_out.read}
159
      assert_match(/^[SF\.]{7}$/,buf)
160
      assert_match(/^[SFE\.]{8}$/,buf)
160 161
    end
161 162

  
162 163
    def test_should_retry_failed_on_workers