diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-24 14:08:37 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-08-24 05:14:56 +0000 |
commit | fbe7962b54096d52d15d31756db80cf5cca5ea98 (patch) | |
tree | c88c7d86f8b89122904ff5c56c54bb19c5d54f4a /test/open-uri | |
parent | 7e0d2c614341521a958f84adbeca738c6824f222 (diff) |
[ruby/open-uri] Close leaked files
https://github.com/ruby/open-uri/commit/c52ee9e430
Diffstat (limited to 'test/open-uri')
-rw-r--r-- | test/open-uri/test_open-uri.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/open-uri/test_open-uri.rb b/test/open-uri/test_open-uri.rb index 8c8f75ce03..86aefc52c8 100644 --- a/test/open-uri/test_open-uri.rb +++ b/test/open-uri/test_open-uri.rb @@ -173,9 +173,12 @@ class TestOpenURI < Test::Unit::TestCase end def test_pass_keywords - require 'tempfile' - t = Tempfile.new - assert_kind_of File, URI.open(Tempfile.new.path, mode: 0666) + begin + f = URI.open(File::NULL, mode: 0666) + assert_kind_of File, f + ensure + f&.close + end o = Object.new def o.open(foo: ) foo end |