Skip to content

Commit 0ce0fef

Browse files
committed
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">
1 parent 402b869 commit 0ce0fef

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/fileutils/test_fileutils.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,11 @@ def test_cp_r_fifo
449449

450450
def test_cp_r_dev
451451
devs = Dir['/dev/*']
452-
chardev = Dir['/dev/*'].find{|f| File.chardev?(f)}
453-
blockdev = Dir['/dev/*'].find{|f| File.blockdev?(f)}
452+
chardev = devs.find{|f| File.chardev?(f)}
453+
blockdev = devs.find{|f| File.blockdev?(f)}
454454
Dir.mkdir('tmp/cpr_dest')
455-
assert_raise(RuntimeError) { cp_r chardev, 'tmp/cpr_dest/cd' }
456-
assert_raise(RuntimeError) { cp_r blockdev, 'tmp/cpr_dest/bd' }
455+
assert_raise(RuntimeError) { cp_r chardev, 'tmp/cpr_dest/cd' } if chardev
456+
assert_raise(RuntimeError) { cp_r blockdev, 'tmp/cpr_dest/bd' } if blockdev
457457
end
458458

459459
begin

0 commit comments

Comments
 (0)