ruby-changes:21316
From: nobu <ko1@a...>
Date: Sat, 1 Oct 2011 04:50:36 +0900 (JST)
Subject: [ruby-changes:21316] nobu:r33365 (trunk): * test/ruby/test_bignum.rb (TestBignum#test_interrupt): fix for
nobu 2011-10-01 04:50:25 +0900 (Sat, 01 Oct 2011) New Revision: 33365 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33365 Log: * test/ruby/test_bignum.rb (TestBignum#test_interrupt): fix for faster CPU. Modified files: trunk/test/ruby/test_bignum.rb Index: test/ruby/test_bignum.rb =================================================================== --- test/ruby/test_bignum.rb (revision 33364) +++ test/ruby/test_bignum.rb (revision 33365) @@ -422,7 +422,7 @@ assert_equal(true, (2**32).even?) end - def interrupt + def assert_interrupt time = Time.now start_flag = false end_flag = false @@ -431,14 +431,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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/