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

ruby-changes:60205

From: Koichi <ko1@a...>
Date: Thu, 27 Feb 2020 02:32:55 +0900 (JST)
Subject: [ruby-changes:60205] 7c1553e91d (master): `srand($seed)` at the beginning of each test

https://git.ruby-lang.org/ruby.git/commit/?id=7c1553e91d

From 7c1553e91db07fed4fed3287b50304f1c69a685d Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Thu, 27 Feb 2020 02:29:57 +0900
Subject: `srand($seed)` at the beginning of each test

To avoid `srand(0)` effect in the other tests, call `srand($seed)`
at the beginning of each test (setup).
[Feature #16655]

diff --git a/tool/lib/minitest/unit.rb b/tool/lib/minitest/unit.rb
index 8569b2c..d739a60 100644
--- a/tool/lib/minitest/unit.rb
+++ b/tool/lib/minitest/unit.rb
@@ -1297,6 +1297,9 @@ module MiniTest https://github.com/ruby/ruby/blob/trunk/tool/lib/minitest/unit.rb#L1297
         start_time = Time.now
 
         result = ""
+
+        srand @options[:seed]
+
         begin
           @passed = nil
           self.before_setup
-- 
cgit v0.10.2


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

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