Skip to content

Commit

Permalink
[ruby/fiddle] Handle#file_name results in very platform dependent
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Jul 15, 2021
1 parent 0d74ddc commit f347b58
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions test/fiddle/test_handle.rb
Expand Up @@ -114,15 +114,21 @@ def test_disable_close

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
Expand Down

0 comments on commit f347b58

Please sign in to comment.