[前][次][番号順一覧][スレッド一覧]

ruby-changes:59040

From: Kazuhiro <ko1@a...>
Date: Mon, 2 Dec 2019 16:26:06 +0900 (JST)
Subject: [ruby-changes:59040] 1a88adcd75 (master): Fix Leaked file descriptor in test/did_you_mean

https://git.ruby-lang.org/ruby.git/commit/?id=1a88adcd75

From 1a88adcd75d92cb36ef5b1d5f4aeb40e6fe4dcb7 Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Mon, 2 Dec 2019 15:21:15 +0900
Subject: Fix Leaked file descriptor in test/did_you_mean

https://github.com/ruby/ruby/commit/de74d2c3b0005048a2c4433bde68b9be10c86f01/checks?check_suite_id=336910877#step:19:131
```
Leaked file descriptor: NameErrorExtensionTest#test_correctable_error_objects_are_dumpable: 7 : #<File:test_name_error_extension.rb>
```

diff --git a/test/did_you_mean/core_ext/test_name_error_extension.rb b/test/did_you_mean/core_ext/test_name_error_extension.rb
index dc571a8..9dc08db 100644
--- a/test/did_you_mean/core_ext/test_name_error_extension.rb
+++ b/test/did_you_mean/core_ext/test_name_error_extension.rb
@@ -35,14 +35,14 @@ class NameErrorExtensionTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/did_you_mean/core_ext/test_name_error_extension.rb#L35
   def test_correctable_error_objects_are_dumpable
     error =
       begin
-        Dir.chdir(__dir__) { File.open('test_name_error_extension.rb').sizee }
+        Dir.chdir(__dir__) { File.open('test_name_error_extension.rb') { |f| f.sizee } }
       rescue NoMethodError => e
         e
       end
 
     error.to_s
 
-    assert_equal "undefined method `sizee' for #<File:test_name_error_extension.rb>",
+    assert_equal "undefined method `sizee' for #<File:test_name_error_extension.rb (closed)>",
                  Marshal.load(Marshal.dump(error)).original_message
   end
 end
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]