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

ruby-changes:32437

From: nobu <ko1@a...>
Date: Tue, 7 Jan 2014 12:41:31 +0900 (JST)
Subject: [ruby-changes:32437] nobu:r44516 (trunk): test_timeout.rb: shorten waiting times

nobu	2014-01-07 12:41:24 +0900 (Tue, 07 Jan 2014)

  New Revision: 44516

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44516

  Log:
    test_timeout.rb: shorten waiting times

  Modified files:
    trunk/test/test_timeout.rb
Index: test/test_timeout.rb
===================================================================
--- test/test_timeout.rb	(revision 44515)
+++ test/test_timeout.rb	(revision 44516)
@@ -6,22 +6,22 @@ class TestTimeout < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_timeout.rb#L6
   def test_queue
     q = Queue.new
     assert_raise(Timeout::Error, "[ruby-dev:32935]") {
-      timeout(0.1) { q.pop }
+      timeout(0.01) { q.pop }
     }
   end
 
   def test_timeout
-    @flag = true
+    flag = true
     Thread.start {
-      sleep 0.1
-      @flag = false
+      sleep 0.01
+      flag = false
     }
     assert_nothing_raised("[ruby-dev:38319]") do
       Timeout.timeout(1) {
-        nil while @flag
+        Thread.pass while flag
       }
     end
-    assert !@flag, "[ruby-dev:38319]"
+    assert !flag, "[ruby-dev:38319]"
   end
 
   def test_cannot_convert_into_time_interval
@@ -34,7 +34,7 @@ class TestTimeout < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_timeout.rb#L34
     bug8730 = '[Bug #8730]'
     e = nil
     assert_raise_with_message(Timeout::Error, /execution expired/, bug8730) do
-      timeout 0.1 do
+      timeout 0.01 do
         begin
           sleep 3
         rescue Exception => e
@@ -48,7 +48,7 @@ class TestTimeout < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_timeout.rb#L48
     exc = Class.new(RuntimeError)
     e = nil
     assert_nothing_raised(exc) do
-      timeout 0.1, exc do
+      timeout 0.01, exc do
         begin
           sleep 3
         rescue exc => e

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

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