ruby-changes:29000
From: kazu <ko1@a...>
Date: Tue, 4 Jun 2013 00:01:53 +0900 (JST)
Subject: [ruby-changes:29000] kazu:r41052 (trunk): FileUtils.rmdir use remove_tailing_slash
kazu 2013-06-04 00:01:42 +0900 (Tue, 04 Jun 2013) New Revision: 41052 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41052 Log: FileUtils.rmdir use remove_tailing_slash * lib/fileutils.rb (FileUtils.rmdir): use remove_tailing_slash. * test/fileutils/test_fileutils.rb: test for above. Modified files: trunk/ChangeLog trunk/lib/fileutils.rb trunk/test/fileutils/test_fileutils.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 41051) +++ ChangeLog (revision 41052) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Jun 3 23:58:19 2013 Kazuhiro NISHIYAMA <zn@m...> + + * 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@f...> * bignum.c (bitlength_bdigit): New function. Index: lib/fileutils.rb =================================================================== --- lib/fileutils.rb (revision 41051) +++ lib/fileutils.rb (revision 41052) @@ -270,7 +270,7 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L270 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) Index: test/fileutils/test_fileutils.rb =================================================================== --- test/fileutils/test_fileutils.rb (revision 41051) +++ test/fileutils/test_fileutils.rb (revision 41052) @@ -1221,6 +1221,14 @@ class TestFileUtils https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L1221 def test_rmdir check_singleton :rmdir + + begin + Dir.rmdir '/' + rescue => e + assert_raise(e.class) { + rmdir '/' + } + end end def test_rmtree -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/