summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-28 12:51:48 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-28 12:51:48 +0000
commit7361eb9462001a24d9d69f1fe8b36657a0a877a5 (patch)
treedb6a096dd0c5f76e9215e6a88e88f5abca305a35
parent38f013391d3ae9556008c37f95bdeb2b9da46de0 (diff)
inspect IO objects before closed IO object test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/lib/leakchecker.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/lib/leakchecker.rb b/test/lib/leakchecker.rb
index 02fffb2e42b..87bc3711c26 100644
--- a/test/lib/leakchecker.rb
+++ b/test/lib/leakchecker.rb
@@ -44,20 +44,21 @@ class LeakChecker
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
}
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
}