summaryrefslogtreecommitdiff
path: root/test/ruby/test_dir.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_dir.rb')
-rw-r--r--test/ruby/test_dir.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb
index b86cf330bc..edb5210af1 100644
--- a/test/ruby/test_dir.rb
+++ b/test/ruby/test_dir.rb
@@ -641,6 +641,21 @@ class TestDir < Test::Unit::TestCase
assert_equal("C:/ruby/homepath", Dir.home)
end;
end
+
+ def test_children_long_name
+ Dir.mktmpdir do |dirname|
+ longest_possible_component = "b" * 255
+ long_path = File.join(dirname, longest_possible_component)
+ Dir.mkdir(long_path)
+ File.write("#{long_path}/c", "")
+ assert_equal(%w[c], Dir.children(long_path))
+ ensure
+ File.unlink("#{long_path}/c")
+ Dir.rmdir(long_path)
+ end
+ rescue Errno::ENOENT
+ omit "File system does not support long file name"
+ end
end
def test_home
@@ -710,7 +725,9 @@ class TestDir < Test::Unit::TestCase
assert_equal(new_dir.chdir{Dir.pwd}, for_fd_dir.chdir{Dir.pwd})
ensure
new_dir&.close
- for_fd_dir&.close
+ if for_fd_dir
+ assert_raise(Errno::EBADF) { for_fd_dir.close }
+ end
end
else
assert_raise(NotImplementedError) { Dir.for_fd(0) }