summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-03 15:01:42 +0000
committerkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-03 15:01:42 +0000
commit1739ecda3b16a2d7c9bd5e845d2209f6e984313e (patch)
tree3843b9112f8ada9ff3cf001525e3e3c2956acd82
parent935d39a5b82aebdb1af7763311590655ff2adf4c (diff)
FileUtils.rmdir use remove_tailing_slash
* lib/fileutils.rb (FileUtils.rmdir): use remove_tailing_slash. * test/fileutils/test_fileutils.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/fileutils.rb2
-rw-r--r--test/fileutils/test_fileutils.rb8
3 files changed, 14 insertions, 1 deletions
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 <zn@mbf.nifty.com>
+
+ * 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 <akr@fsij.org>
* 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