diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_io.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 3d1dada06c..a181b41023 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1225,4 +1225,22 @@ class TestIO < Test::Unit::TestCase def test_uninitialized assert_raise(IOError) { IO.allocate.print "" } end + + def test_nofollow + return unless defined? File::NOFOLLOW + mkcdtmpdir { + open("file", "w") {|f| f << "content" } + begin + File.symlink("file", "slnk") + rescue NotImplementedError + return + end + assert_raise(Errno::ELOOP) { + open("slnk", File::RDONLY|File::NOFOLLOW) {} + } + assert_raise(Errno::ELOOP) { + File.foreach("slnk", :open_args=>[File::RDONLY|File::NOFOLLOW]) {} + } + } + end end |