diff options
Diffstat (limited to 'test/ruby/test_rand.rb')
-rw-r--r-- | test/ruby/test_rand.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_rand.rb b/test/ruby/test_rand.rb index b7d841dbba..4887377c6d 100644 --- a/test/ruby/test_rand.rb +++ b/test/ruby/test_rand.rb @@ -164,4 +164,14 @@ class TestRand < Test::Unit::TestCase srand(0) assert_equal([1,4,2,5,3], [1,2,3,4,5].shuffle) end + + def test_fork_shuffle + pid = fork do + (1..10).to_a.shuffle + raise 'default seed is not set' if srand == 0 + end + p2, st = Process.waitpid2(pid) + assert(st.success?) + rescue NotImplementedError, ArgumentError + end end |