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

ruby-changes:34520

From: akr <ko1@a...>
Date: Sat, 28 Jun 2014 21:51:58 +0900 (JST)
Subject: [ruby-changes:34520] akr:r46601 (trunk): inspect IO objects before closed IO object test.

akr	2014-06-28 21:51:48 +0900 (Sat, 28 Jun 2014)

  New Revision: 46601

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

  Log:
    inspect IO objects before closed IO object test.

  Modified files:
    trunk/test/lib/leakchecker.rb
Index: test/lib/leakchecker.rb
===================================================================
--- test/lib/leakchecker.rb	(revision 46600)
+++ test/lib/leakchecker.rb	(revision 46601)
@@ -44,20 +44,21 @@ class LeakChecker https://github.com/ruby/ruby/blob/trunk/test/lib/leakchecker.rb#L44
       leaked = true
       h = {}
       ObjectSpace.each_object(IO) {|io|
+        inspect = io.inspect
         begin
           autoclose = io.autoclose?
           fd = io.fileno
         rescue IOError # closed IO object
           next
         end
-        (h[fd] ||= []) << [io, autoclose]
+        (h[fd] ||= []) << [io, autoclose, inspect]
       }
       fd_leaked.each {|fd|
         str = ''
         if h[fd]
           str << ' :'
-          h[fd].map {|io, autoclose|
-            s = ' ' + io.inspect
+          h[fd].map {|io, autoclose, inspect|
+            s = ' ' + inspect
             s << "(not-autoclose)" if !autoclose
             s
           }.sort.each {|s|
@@ -68,8 +69,8 @@ class LeakChecker https://github.com/ruby/ruby/blob/trunk/test/lib/leakchecker.rb#L69
       }
       h.each {|fd, list|
         next if list.length <= 1
-        if 1 < list.count {|io, autoclose| autoclose }
-          str = list.map {|io, autoclose| " #{io.inspect}" + (autoclose ? "(autoclose)" : "") }.sort.join
+        if 1 < list.count {|io, autoclose, inspect| autoclose }
+          str = list.map {|io, autoclose, inspect| " #{inspect}" + (autoclose ? "(autoclose)" : "") }.sort.join
           puts "Multiple autoclose IO object for a file descriptor:#{str}"
         end
       }

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

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