mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[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:
parent
9494ef8b2d
commit
9792c9d183
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue