diff --git a/ChangeLog b/ChangeLog index ded56360f3..fa5f0039fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jun 3 23:58:19 2013 Kazuhiro NISHIYAMA + + * lib/fileutils.rb (FileUtils.rmdir): use remove_tailing_slash. + * test/fileutils/test_fileutils.rb: test for above. + Mon Jun 3 23:47:55 2013 Tanaka Akira * bignum.c (bitlength_bdigit): New function. diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 7f14f138d9..5bdeeaeb08 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -270,7 +270,7 @@ module FileUtils return if options[:noop] list.each do |dir| begin - Dir.rmdir(dir = dir.chomp(?/)) + Dir.rmdir(dir = remove_tailing_slash(dir)) if parents until (parent = File.dirname(dir)) == '.' or parent == dir Dir.rmdir(dir) diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index b03c9ba2be..13fb26abc6 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -1221,6 +1221,14 @@ class TestFileUtils def test_rmdir check_singleton :rmdir + + begin + Dir.rmdir '/' + rescue => e + assert_raise(e.class) { + rmdir '/' + } + end end def test_rmtree