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

ruby-changes:56194

From: Nobuyoshi <ko1@a...>
Date: Sat, 22 Jun 2019 23:51:40 +0900 (JST)
Subject: [ruby-changes:56194] Nobuyoshi Nakada: f5e2904471 (trunk): Use EXEEXT

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

From f5e29044710e74249e89bbb0f112dc22e5b91398 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 22 Jun 2019 23:44:19 +0900
Subject: Use EXEEXT

* test/lib/minitest/unit.rb (MiniTest::Assertions.diff): use
  `EXEEXT` configured value instead of switching by hard coded
  `host_os`.

diff --git a/test/lib/minitest/unit.rb b/test/lib/minitest/unit.rb
index 6ba1c70..d922a5f 100644
--- a/test/lib/minitest/unit.rb
+++ b/test/lib/minitest/unit.rb
@@ -79,18 +79,14 @@ module MiniTest https://github.com/ruby/ruby/blob/trunk/test/lib/minitest/unit.rb#L79
     # figure out what diff to use.
 
     def self.diff
-      @diff = if (RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ &&
-                  system("diff.exe", __FILE__, __FILE__)) then
-                "diff.exe -u"
-              elsif Minitest::Unit::Guard.maglev? then # HACK
-                "diff -u"
-              elsif system("gdiff", __FILE__, __FILE__)
-                "gdiff -u" # solaris and kin suck
-              elsif system("diff", __FILE__, __FILE__)
-                "diff -u"
-              else
-                nil
-              end unless defined? @diff
+      unless defined? @diff
+        exe = RbConfig::CONFIG['EXEEXT']
+        @diff = %W"gdiff#{exe} diff#{exe}".find do |diff|
+          if system(diff, "-u", __FILE__, __FILE__)
+            break "#{diff} -u"
+          end
+        end
+      end
 
       @diff
     end
-- 
cgit v0.10.2


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

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