heidistein / rpms / ruby

Forked from rpms/ruby 9 months ago
Clone
Blob Blame Raw
--- ruby-1.9.3-p0/test/ruby/test_bignum.rb.orig	2011-11-10 09:52:59.101925465 +0100
+++ ruby-1.9.3-p0/test/ruby/test_bignum.rb	2011-11-10 09:54:14.580798826 +0100
@@ -378,7 +378,7 @@
     assert_equal(true, (2**32).even?)
   end
 
-  def interrupt
+  def assert_interrupt
     time = Time.now
     start_flag = false
     end_flag = false
@@ -387,14 +387,16 @@
       yield
       end_flag = true
     end
-    sleep 1
+    Thread.pass until start_flag
     thread.raise
     thread.join rescue nil
-    start_flag && !end_flag && Time.now - time < 10
+    time = Time.now - time
+    assert_equal([true, false], [start_flag, end_flag])
+    assert_operator(time, :<, 10)
   end
 
   def test_interrupt
-    assert(interrupt { (65536 ** 65536).to_s })
+    assert_interrupt {(65536 ** 65536).to_s}
   end
 
   def test_too_big_to_s