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

ruby-changes:60210

From: Koichi <ko1@a...>
Date: Thu, 27 Feb 2020 04:10:55 +0900 (JST)
Subject: [ruby-changes:60210] 6b30638bdb (master): MiniTest::Unit.options has default :seed

https://git.ruby-lang.org/ruby.git/commit/?id=6b30638bdb

From 6b30638bdb729c73a05190587123e43e2ffd69f3 Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Thu, 27 Feb 2020 04:06:28 +0900
Subject: MiniTest::Unit.options has default :seed

MiniTest::Unit (superclass of Test::Unit::Runner) does not has
default seed parameter, but assigned after initializing.
However some tests use MiniTest::Unit without setup of seed option
and it cases unexpected test failures. To solve this issue, add
default seed parameter 42.

diff --git a/tool/lib/minitest/unit.rb b/tool/lib/minitest/unit.rb
index 0b0d892..f4e5e4e 100644
--- a/tool/lib/minitest/unit.rb
+++ b/tool/lib/minitest/unit.rb
@@ -763,7 +763,7 @@ module MiniTest https://github.com/ruby/ruby/blob/trunk/tool/lib/minitest/unit.rb#L763
     # Lazy accessor for options.
 
     def options
-      @options ||= {}
+      @options ||= {seed: 42}
     end
 
     @@installed_at_exit ||= false
diff --git a/tool/test/minitest/metametameta.rb b/tool/test/minitest/metametameta.rb
index f7e0f02..a12717c 100644
--- a/tool/test/minitest/metametameta.rb
+++ b/tool/test/minitest/metametameta.rb
@@ -47,7 +47,6 @@ class MetaMetaMetaTestCase < MiniTest::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/minitest/metametameta.rb#L47
     srand 42
     MiniTest::Unit::TestCase.reset
     @tu = MiniTest::Unit.new
-    @tu.options[:seed] = 42
 
     MiniTest::Unit.runner = nil # protect the outer runner from the inner tests
   end
-- 
cgit v0.10.2


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

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