summaryrefslogtreecommitdiff
path: root/test/lib/minitest
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-30 06:27:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-30 06:27:23 +0000
commitbb1fb1167e09b88f3c41a7b7e1c6aca14b74b4b7 (patch)
tree71bd991fd4f36a068edbd4857241d598a0d0998d /test/lib/minitest
parent5cc1d57c3957ecabe02c5ad79dd75c523457187f (diff)
minitest/unit.rb: defer requiring -test-
* test/lib/minitest/unit.rb (find_fds): defer requiring a library under "-test-" until needed, or can't work in other (installed) ruby. grep doesn't need separated map. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/lib/minitest')
-rw-r--r--test/lib/minitest/unit.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/test/lib/minitest/unit.rb b/test/lib/minitest/unit.rb
index 2f31d6d..4dc4d33 100644
--- a/test/lib/minitest/unit.rb
+++ b/test/lib/minitest/unit.rb
@@ -2,7 +2,6 @@
require "optparse"
require "rbconfig"
-require "-test-/dir"
##
# Minimal (mostly drop-in) replacement for test-unit.
@@ -991,19 +990,17 @@ module MiniTest
end
def find_fds
- fd_dir = "/proc/#{$$}/fd"
+ fd_dir = "/proc/self/fd"
if File.directory?(fd_dir)
+ require "-test-/dir"
fds = Dir.open(fd_dir) {|d|
- a = []
- while fn = d.read
- a << fn
- end
+ a = d.grep(/\A\d+\z/, &:to_i)
if d.respond_to? :fileno
- a -= [d.fileno.to_s]
+ a -= [d.fileno]
end
a
}
- fds.grep(/\A\d+\z/).map(&:to_i).sort
+ fds.sort
else
[]
end