[前][次][番号順一覧][スレッド一覧]

ruby-changes:66789

From: Nobuyoshi <ko1@a...>
Date: Thu, 15 Jul 2021 09:51:36 +0900 (JST)
Subject: [ruby-changes:66789] f347b586fb (master): [ruby/fiddle] Handle#file_name results in very platform dependent

https://git.ruby-lang.org/ruby.git/commit/?id=f347b586fb

From f347b586fb2ae53a630593a39984a4f1e9dae10b Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 15 Jul 2021 09:49:56 +0900
Subject: [ruby/fiddle] Handle#file_name results in very platform dependent

---
 test/fiddle/test_handle.rb | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/test/fiddle/test_handle.rb b/test/fiddle/test_handle.rb
index 54ae0aa..c0e85f7 100644
--- a/test/fiddle/test_handle.rb
+++ b/test/fiddle/test_handle.rb
@@ -114,15 +114,21 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/test/fiddle/test_handle.rb#L114
 
     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
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]