mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* lib/find.rb (Find#find): should pass ignore_error option to enumerators.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									d0a9ee1e86
								
							
						
					
					
						commit
						c754b22797
					
				
					 3 changed files with 25 additions and 1 deletions
				
			
		|  | @ -1,3 +1,7 @@ | |||
| Tue Mar  4 00:25:35 2014  Kazuki Tsujimoto  <kazuki@callcc.net> | ||||
| 
 | ||||
| 	* lib/find.rb (Find#find): should pass ignore_error option to enumerators. | ||||
| 
 | ||||
| Mon Mar  3 13:27:35 2014  NAKAMURA Usaku  <usa@ruby-lang.org> | ||||
| 
 | ||||
| 	* test/test_find.rb (TestFind#test_unsearchable_dir): ruby cannot make | ||||
|  |  | |||
|  | @ -35,7 +35,7 @@ module Find | |||
|   # See the +Find+ module documentation for an example. | ||||
|   # | ||||
|   def find(*paths, ignore_error: true) # :yield: path | ||||
|     block_given? or return enum_for(__method__, *paths) | ||||
|     block_given? or return enum_for(__method__, *paths, ignore_error: ignore_error) | ||||
| 
 | ||||
|     fs_encoding = Encoding.find("filesystem") | ||||
| 
 | ||||
|  |  | |||
|  | @ -105,11 +105,21 @@ class TestFind < Test::Unit::TestCase | |||
|         Find.find(d, ignore_error: true) {|f| a << f } | ||||
|         assert_equal([d, dir], a) | ||||
| 
 | ||||
|         a = [] | ||||
|         Find.find(d, ignore_error: true).each {|f| a << f } | ||||
|         assert_equal([d, dir], a) | ||||
| 
 | ||||
|         a = [] | ||||
|         assert_raise_with_message(Errno::EACCES, /#{Regexp.quote(dir)}/) do | ||||
|           Find.find(d, ignore_error: false) {|f| a << f } | ||||
|         end | ||||
|         assert_equal([d, dir], a) | ||||
| 
 | ||||
|         a = [] | ||||
|         assert_raise_with_message(Errno::EACCES, /#{Regexp.quote(dir)}/) do | ||||
|           Find.find(d, ignore_error: false).each {|f| a << f } | ||||
|         end | ||||
|         assert_equal([d, dir], a) | ||||
|       ensure | ||||
|         File.chmod(0700, dir) | ||||
|       end | ||||
|  | @ -130,6 +140,10 @@ class TestFind < Test::Unit::TestCase | |||
|         Find.find(d, ignore_error: true) {|f| a << f } | ||||
|         assert_equal([d, dir, file], a) | ||||
| 
 | ||||
|         a = [] | ||||
|         Find.find(d, ignore_error: true).each {|f| a << f } | ||||
|         assert_equal([d, dir, file], a) | ||||
| 
 | ||||
|         skip "no meaning test on Windows" if /mswin|mingw/ =~ RUBY_PLATFORM | ||||
|         a = [] | ||||
|         assert_raise_with_message(Errno::EACCES, /#{Regexp.quote(file)}/) do | ||||
|  | @ -137,6 +151,12 @@ class TestFind < Test::Unit::TestCase | |||
|         end | ||||
|         assert_equal([d, dir, file], a) | ||||
| 
 | ||||
|         a = [] | ||||
|         assert_raise_with_message(Errno::EACCES, /#{Regexp.quote(file)}/) do | ||||
|           Find.find(d, ignore_error: false).each {|f| a << f } | ||||
|         end | ||||
|         assert_equal([d, dir, file], a) | ||||
| 
 | ||||
|         assert_raise(Errno::EACCES) { File.lstat(file) } | ||||
|       ensure | ||||
|         File.chmod(0700, dir) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 ktsj
						ktsj