summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2023-11-08 08:35:16 -0800
committergit <svn-admin@ruby-lang.org>2023-11-08 16:47:29 +0000
commitddd99a529005eade4e99735e7aba8166f4a32ca2 (patch)
treeffa4d66ca2ce0fadd29d32bd746e6949b915a5cd /test
parenteb2abc3f16685979ea87861900fb33b3a975589e (diff)
[ruby/tempfile] Make Tempfile#open return the underlying File
Add test for this behavior. https://github.com/ruby/tempfile/commit/0ca31a6b8d
Diffstat (limited to 'test')
-rw-r--r--test/test_tempfile.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_tempfile.rb b/test/test_tempfile.rb
index d5d684b016..eddbac5d75 100644
--- a/test/test_tempfile.rb
+++ b/test/test_tempfile.rb
@@ -378,6 +378,14 @@ puts Tempfile.new('foo').path
assert_file.not_exist?(path)
end
+ def test_open
+ Tempfile.open {|f|
+ file = f.open
+ assert_kind_of File, file
+ assert_equal f.to_i, file.to_i
+ }
+ end
+
def test_open_traversal_dir
assert_mktmpdir_traversal do |traversal_path|
t = Tempfile.open([traversal_path, 'foo'])