From 676fe089bde36dcae76b9fe2a6c1848251228837 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 1 Apr 2015 00:59:14 +0000 Subject: fileutils.rb: fix error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lib/fileutils.rb (FileUtils#mv): show the exact target path in the error message instead of the destination parent directory name. patched by João Britto at [ruby-core:68706]. [Bug #11021] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ lib/fileutils.rb | 2 +- test/fileutils/test_fileutils.rb | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83bfe0753b..790673b7c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Apr 1 09:59:12 2015 Nobuyoshi Nakada + + * lib/fileutils.rb (FileUtils#mv): show the exact target path in + the error message instead of the destination parent directory + name. patched by Joao Britto at + [ruby-core:68706]. [Bug #11021] + Tue Mar 31 15:25:07 2015 SHIBATA Hiroshi * doc/ChangeLog-0.06_to_0.52: added archived Changelog. diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 23fd19310a..932776c847 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -518,7 +518,7 @@ module FileUtils begin if destent.exist? if destent.directory? - raise Errno::EEXIST, dest + raise Errno::EEXIST, d else destent.remove_file if rename_cannot_overwrite_file? end diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index fe9a1b327d..295fbfd960 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -416,7 +416,8 @@ class TestFileUtils < Test::Unit::TestCase mkdir 'tmp/tmpdir' mkdir_p 'tmp/dest2/tmpdir' - assert_raise(Errno::EEXIST) { + assert_raise_with_message(Errno::EEXIST, %r' - tmp/dest2/tmpdir\z', + '[ruby-core:68706] [Bug #11021]') { mv 'tmp/tmpdir', 'tmp/dest2' } mkdir 'tmp/dest2/tmpdir/junk' -- cgit v1.2.3