1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-02-19 14:38:28 +00:00
parent c7f815eed8
commit 3ad8210ce1
3 changed files with 17 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Fri Feb 19 23:37:52 2016 Masahiro Tomita <tommy@tmtm.org>
* 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@it.aoyama.ac.jp>
* enc/unicode.c: Activated use of case mapping data in CaseUnfold_11 array.

View file

@ -40,7 +40,7 @@ module Find
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]

View file

@ -12,6 +12,17 @@ class TestFind < Test::Unit::TestCase
}
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"){}