diff options
Diffstat (limited to 'test/test_find.rb')
-rw-r--r-- | test/test_find.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test_find.rb b/test/test_find.rb index af0cb2dc95..cb2ce56129 100644 --- a/test/test_find.rb +++ b/test/test_find.rb @@ -106,10 +106,20 @@ class TestFind < Test::Unit::TestCase 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) |