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

ruby-changes:57973

From: Jeremy <ko1@a...>
Date: Fri, 27 Sep 2019 13:05:52 +0900 (JST)
Subject: [ruby-changes:57973] 9792c9d183 (master): [ruby/fileutils] Fix test_cp_r_dev on Windows or other systems without character/block device in /dev

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

From 9792c9d183ccc0e80230858c910c74cfef5ddc32 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Fri, 23 Aug 2019 14:50:34 -0700
Subject: [ruby/fileutils] Fix test_cp_r_dev on Windows or other systems
 without character/block device in /dev

Previously this would give an error such as:

TestFileUtils#test_cp_r_dev [c:/fileutils/test/fileutils/test_fileutils.rb:455]:
[RuntimeError] exception expected, not.
Class: <TypeError>
Message: <"no implicit conversion of nil into String">

https://github.com/ruby/fileutils/commit/0ce0fefbeb

diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb
index 41100e1..23f05d2 100644
--- a/test/fileutils/test_fileutils.rb
+++ b/test/fileutils/test_fileutils.rb
@@ -450,11 +450,11 @@ class TestFileUtils < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L450
 
   def test_cp_r_dev
     devs = Dir['/dev/*']
-    chardev = Dir['/dev/*'].find{|f| File.chardev?(f)}
-    blockdev = Dir['/dev/*'].find{|f| File.blockdev?(f)}
+    chardev = devs.find{|f| File.chardev?(f)}
+    blockdev = devs.find{|f| File.blockdev?(f)}
     Dir.mkdir('tmp/cpr_dest')
-    assert_raise(RuntimeError) { cp_r chardev, 'tmp/cpr_dest/cd' }
-    assert_raise(RuntimeError) { cp_r blockdev, 'tmp/cpr_dest/bd' }
+    assert_raise(RuntimeError) { cp_r chardev, 'tmp/cpr_dest/cd' } if chardev
+    assert_raise(RuntimeError) { cp_r blockdev, 'tmp/cpr_dest/bd' } if blockdev
   end
 
   begin
-- 
cgit v0.10.2


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

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