diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-08-23 14:50:34 -0700 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-09-27 11:39:02 +0900 |
commit | 9792c9d183ccc0e80230858c910c74cfef5ddc32 (patch) | |
tree | 8929952b771f7297bec232cbbfee9d6679a043e1 /test/fileutils | |
parent | 9494ef8b2de3a7224eb85800606e7c046964cbd2 (diff) | |
download | ruby-9792c9d183ccc0e80230858c910c74cfef5ddc32.tar.gz |
[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
Diffstat (limited to 'test/fileutils')
-rw-r--r-- | test/fileutils/test_fileutils.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index 41100e12a9..23f05d2b44 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -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 |