summaryrefslogtreecommitdiff
path: root/test/fiddle
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-04-01 12:37:01 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-04-01 12:48:56 +0900
commit5a81562dfed2d5839e28b654d4f0f69de632aa8e (patch)
tree5b62c0dee4aeabc2e5d39039ff20319bbf221fe9 /test/fiddle
parent57a36a1698774ea4b8ac81fd62a241ffced664d2 (diff)
`Dir.glob` always returns an array
It is not needed to test itself, but the element should be tested instead.
Diffstat (limited to 'test/fiddle')
-rw-r--r--test/fiddle/helper.rb15
1 files changed, 5 insertions, 10 deletions
diff --git a/test/fiddle/helper.rb b/test/fiddle/helper.rb
index f5c7bd2ca6..f405b53a53 100644
--- a/test/fiddle/helper.rb
+++ b/test/fiddle/helper.rb
@@ -31,12 +31,8 @@ when /linux/
# In the ARM 32-bit libc package such as libc6:armhf libc6:armel,
# libc.so and libm.so are installed to /lib/arm-linux-gnu*.
# It's not installed to /lib32.
- dirs = Dir.glob('/lib/arm-linux-gnu*')
- if dirs.length > 0
- libdir = dirs[0] if dirs && File.directory?(dirs[0])
- else # handle alpine environment
- libdir = '/lib' if File.directory? '/lib'
- end
+ dir, = Dir.glob('/lib/arm-linux-gnu*')
+ libdir = dir if dir && File.directory?(dir)
else
libdir = '/lib32' if File.directory? '/lib32'
end
@@ -46,10 +42,9 @@ when /linux/
end
# Handle musl libc
- libc = Dir.glob(File.join(libdir, "libc.musl*.so*"))
- if libc && libc.length > 0
- libc_so = libc[0]
- libm_so = libc[0]
+ libc_so, = Dir.glob(File.join(libdir, "libc.musl*.so*"))
+ if libc_so
+ libm_so = libc_so
else
# glibc
libc_so = File.join(libdir, "libc.so.6")