ruby-changes:41800
From: nobu <ko1@a...>
Date: Fri, 19 Feb 2016 23:38:00 +0900 (JST)
Subject: [ruby-changes:41800] nobu:r53874 (trunk): find.rb: raise with the name
nobu 2016-02-19 23:38:28 +0900 (Fri, 19 Feb 2016) New Revision: 53874 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53874 Log: find.rb: raise with the name * lib/find.rb (Find#find): raise with the given path name if it does not exist. [ruby-dev:49497] [Bug #12087] Modified files: trunk/ChangeLog trunk/lib/find.rb trunk/test/test_find.rb Index: test/test_find.rb =================================================================== --- test/test_find.rb (revision 53873) +++ test/test_find.rb (revision 53874) @@ -12,6 +12,17 @@ class TestFind < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_find.rb#L12 } end + def test_nonexistence + bug12087 = '[ruby-dev:49497] [Bug #12087]' + Dir.mktmpdir {|d| + path = "#{d}/a" + re = /#{Regexp.quote(path)}\z/ + assert_raise_with_message(Errno::ENOENT, re, bug12087) { + Find.find(path) {} + } + } + end + def test_rec Dir.mktmpdir {|d| File.open("#{d}/a", "w"){} Index: lib/find.rb =================================================================== --- lib/find.rb (revision 53873) +++ lib/find.rb (revision 53874) @@ -40,7 +40,7 @@ module Find https://github.com/ruby/ruby/blob/trunk/lib/find.rb#L40 fs_encoding = Encoding.find("filesystem") - paths.collect!{|d| raise Errno::ENOENT unless File.exist?(d); d.dup}.each do |path| + paths.collect!{|d| raise Errno::ENOENT, d unless File.exist?(d); d.dup}.each do |path| path = path.to_path if path.respond_to? :to_path enc = path.encoding == Encoding::US_ASCII ? fs_encoding : path.encoding ps = [path] Index: ChangeLog =================================================================== --- ChangeLog (revision 53873) +++ ChangeLog (revision 53874) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Feb 19 23:37:52 2016 Masahiro Tomita <tommy@t...> + + * lib/find.rb (Find#find): raise with the given path name if it + does not exist. [ruby-dev:49497] [Bug #12087] + Fri Feb 19 12:44:57 2016 Martin Duerst <duerst@i...> * enc/unicode.c: Activated use of case mapping data in CaseUnfold_11 array. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/