1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/fiddle] Handle#file_name results in very platform dependent

This commit is contained in:
Nobuyoshi Nakada 2021-07-15 09:49:56 +09:00
parent 0d74ddc5ff
commit f347b586fb
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -114,15 +114,21 @@ module Fiddle
def test_file_name
file_name = Handle.new(LIBC_SO).file_name
assert_kind_of String, file_name
expected = File.basename(File.realpath(LIBC_SO))
basename = File.basename(file_name)
if File::FNM_SYSCASE.zero?
assert_equal expected, basename
else
assert_send [basename, :casecmp?, expected]
if file_name
assert_kind_of String, file_name
expected = [File.basename(LIBC_SO)]
begin
expected << File.basename(File.realpath(LIBC_SO, File.dirname(file_name)))
rescue Errno::ENOENT
end
basename = File.basename(file_name)
unless File::FNM_SYSCASE.zero?
basename.downcase!
expected.each(&:downcase!)
end
assert_include expected, basename
end
end unless /darwin/ =~ RUBY_PLATFORM
end
def test_NEXT
begin