mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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]
This commit is contained in:
parent
f9d314245b
commit
14f1790807
2 changed files with 3 additions and 0 deletions
|
@ -1297,6 +1297,8 @@ module MiniTest
|
|||
start_time = Time.now
|
||||
|
||||
result = ""
|
||||
srand(runner.options[:seed])
|
||||
|
||||
begin
|
||||
@passed = nil
|
||||
self.before_setup
|
||||
|
|
|
@ -47,6 +47,7 @@ class MetaMetaMetaTestCase < MiniTest::Unit::TestCase
|
|||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue