[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
This commit is contained in:
Jeremy Evans 2019-08-23 14:50:34 -07:00 коммит произвёл Hiroshi SHIBATA
Родитель 9494ef8b2d
Коммит 9792c9d183
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F9CF13417264FAC2
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -450,11 +450,11 @@ class TestFileUtils < Test::Unit::TestCase
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