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

ruby-changes:42901

From: nobu <ko1@a...>
Date: Wed, 11 May 2016 21:24:23 +0900 (JST)
Subject: [ruby-changes:42901] nobu:r54975 (trunk): test_minitest_unit.rb: fix "random" sort

nobu	2016-05-11 21:24:16 +0900 (Wed, 11 May 2016)

  New Revision: 54975

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

  Log:
    test_minitest_unit.rb: fix "random" sort
    
    * test/minitest/test_minitest_unit.rb (test_test_methods_random):
      hack to fix the order by avoiding duplicate keys.

  Modified files:
    trunk/test/minitest/test_minitest_unit.rb
Index: test/minitest/test_minitest_unit.rb
===================================================================
--- test/minitest/test_minitest_unit.rb	(revision 54974)
+++ test/minitest/test_minitest_unit.rb	(revision 54975)
@@ -1623,15 +1623,11 @@ class TestMiniTestUnitTestCase < MiniTes https://github.com/ruby/ruby/blob/trunk/test/minitest/test_minitest_unit.rb#L1623
       def test_test1; assert "does not matter" end
       def test_test2; assert "does not matter" end
       def test_test3; assert "does not matter" end
+      @test_order = [1, 0, 2]
+      def self.rand(n) @test_order.shift; end
     end
 
-    srand 42
-    expected = case
-               when maglev? then
-                 %w(test_test2 test_test3 test_test1)
-               else
-                 %w(test_test2 test_test1 test_test3)
-               end
+    expected = %w(test_test2 test_test1 test_test3)
     assert_equal expected, sample_test_case.test_methods
   end
 

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

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