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

ruby-changes:50889

From: usa <ko1@a...>
Date: Thu, 5 Apr 2018 00:45:49 +0900 (JST)
Subject: [ruby-changes:50889] usa:r63096 (trunk): * test/test_tempfile.rb (test_{new, create}_traversal_dir): should not assume `t`

usa	2018-04-05 00:44:56 +0900 (Thu, 05 Apr 2018)

  New Revision: 63096

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63096

  Log:
    * test/test_tempfile.rb (test_{new,create}_traversal_dir): should not assume `t`
      is always set.  if `t` is nil, `NoMethodError` will be raised and the real
      cause will be hidden.

  Modified files:
    trunk/test/test_tempfile.rb
Index: test/test_tempfile.rb
===================================================================
--- test/test_tempfile.rb	(revision 63095)
+++ test/test_tempfile.rb	(revision 63096)
@@ -391,7 +391,7 @@ puts Tempfile.new('foo').path https://github.com/ruby/ruby/blob/trunk/test/test_tempfile.rb#L391
     actual = Dir.glob(TRAVERSAL_PATH + '*').count
     assert_equal expect, actual
   ensure
-    t.close!
+    t&.close!
   end
 
   def test_create_traversal_dir
@@ -400,6 +400,6 @@ puts Tempfile.new('foo').path https://github.com/ruby/ruby/blob/trunk/test/test_tempfile.rb#L400
     actual = Dir.glob(TRAVERSAL_PATH + '*').count
     assert_equal expect, actual
   ensure
-    t.close
+    t&.close
   end
 end

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

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