summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-22 23:44:19 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-22 23:48:21 +0900
commitf5e29044710e74249e89bbb0f112dc22e5b91398 (patch)
tree48786ccaea7ae56d748ed0e210dc224bf6066a10 /test
parentf738eeabc251c556feda1f9f22c060dac85054e1 (diff)
Use EXEEXT
* test/lib/minitest/unit.rb (MiniTest::Assertions.diff): use `EXEEXT` configured value instead of switching by hard coded `host_os`.
Diffstat (limited to 'test')
-rw-r--r--test/lib/minitest/unit.rb20
1 files changed, 8 insertions, 12 deletions
diff --git a/test/lib/minitest/unit.rb b/test/lib/minitest/unit.rb
index 6ba1c707e6e..d922a5fc412 100644
--- a/test/lib/minitest/unit.rb
+++ b/test/lib/minitest/unit.rb
@@ -79,18 +79,14 @@ module MiniTest
# 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