Use only object_id to test living threads.

Previous test depends on timing like:

  <"[#<Thread:0x000008013413a0 run>, #<Thread:0x00000801341418 run>,
    #<Thread:0x00000801364940 run>]"> expected but was
  <"[#<Thread:0x000008013413a0 run>, #<Thread:0x00000801341418 sleep>,
    #<Thread:0x00000801364940 run>]">.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-02-19 07:01:11 +00:00
parent c840e4578f
commit 6b9c2e9d77

View File

@ -232,8 +232,8 @@ class TestThread < Test::Unit::TestCase
Thread.pass Thread.pass
t2 = Thread.new { loop { } } t2 = Thread.new { loop { } }
t3 = Thread.new { }.join t3 = Thread.new { }.join
p [Thread.current, t1, t2].sort_by {|t| t.object_id } p [Thread.current, t1, t2].map{|t| t.object_id }.sort
p Thread.list.sort_by {|t| t.object_id } p Thread.list.map{|t| t.object_id }.sort
INPUT INPUT
assert_equal(r.first, r.last) assert_equal(r.first, r.last)
assert_equal([], e) assert_equal([], e)