[前][次][番号順一覧][スレッド一覧]

ruby-changes:14847

From: naruse <ko1@a...>
Date: Fri, 19 Feb 2010 16:01:22 +0900 (JST)
Subject: [ruby-changes:14847] Ruby:r26713 (trunk): Use only object_id to test living threads.

naruse	2010-02-19 16:01:11 +0900 (Fri, 19 Feb 2010)

  New Revision: 26713

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26713

  Log:
    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>]">.

  Modified files:
    trunk/test/ruby/test_thread.rb

Index: test/ruby/test_thread.rb
===================================================================
--- test/ruby/test_thread.rb	(revision 26712)
+++ test/ruby/test_thread.rb	(revision 26713)
@@ -232,8 +232,8 @@
       Thread.pass
       t2 = Thread.new { loop { } }
       t3 = Thread.new { }.join
-      p [Thread.current, t1, t2].sort_by {|t| t.object_id }
-      p Thread.list.sort_by {|t| t.object_id }
+      p [Thread.current, t1, t2].map{|t| t.object_id }.sort
+      p Thread.list.map{|t| t.object_id }.sort
     INPUT
       assert_equal(r.first, r.last)
       assert_equal([], e)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]