mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
parent
3dced7955c
commit
4431ca5363
2 changed files with 10 additions and 1 deletions
|
@ -1487,7 +1487,8 @@ module FileUtils
|
|||
# Related: {methods for deleting}[rdoc-ref:FileUtils@Deleting].
|
||||
#
|
||||
def remove_dir(path, force = false)
|
||||
remove_entry path, force # FIXME?? check if it is a directory
|
||||
raise Errno::ENOTDIR, path unless File.directory?(path)
|
||||
remove_entry path, force
|
||||
end
|
||||
module_function :remove_dir
|
||||
|
||||
|
|
|
@ -1812,6 +1812,14 @@ class TestFileUtils < Test::Unit::TestCase
|
|||
assert_file_not_exist 'data/tmpdir'
|
||||
end if have_file_perm?
|
||||
|
||||
def test_remove_dir_with_file
|
||||
File.write('data/tmpfile', 'dummy')
|
||||
assert_raise(Errno::ENOTDIR) { remove_dir 'data/tmpfile' }
|
||||
assert_file_exist 'data/tmpfile'
|
||||
ensure
|
||||
File.unlink('data/tmpfile') if File.exist?('data/tmpfile')
|
||||
end
|
||||
|
||||
def test_compare_file
|
||||
check_singleton :compare_file
|
||||
# FIXME
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue