diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-14 02:22:51 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-14 02:22:51 +0000 |
commit | 056a26e1ee0152991e884accd037724a0b4dd8bb (patch) | |
tree | 6b61e355a5c0bb50a9952ae58e3fb09b6266cc62 /test | |
parent | 1cacdd4686259e1cf0059b2210882a32268d1360 (diff) | |
download | ruby-056a26e1ee0152991e884accd037724a0b4dd8bb.tar.gz |
webrick/utils.rb: wakeup immediately
* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#register):
notify the handler thread of new timeout registration.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/webrick/test_utils.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/webrick/test_utils.rb b/test/webrick/test_utils.rb index 3ab4f2b126..9d135f7855 100644 --- a/test/webrick/test_utils.rb +++ b/test/webrick/test_utils.rb @@ -5,7 +5,7 @@ class TestWEBrickUtils < Test::Unit::TestCase def assert_expired(flag, m) if m == WEBrick::Utils handler = WEBrick::Utils::TimeoutHandler.instance - assert_equal(flag, handler.instance_eval{ @timeout_info.empty? }) + assert_equal(flag, handler.instance_variable_get(:@timeout_info).empty?) end end @@ -21,8 +21,8 @@ class TestWEBrickUtils < Test::Unit::TestCase m = WEBrick::Utils i = 0 assert_raise(Timeout::Error){ - m.timeout(2){ - assert_raise(Timeout::Error){ m.timeout(1){ i += 1; sleep } } + m.timeout(0.02){ + assert_raise(Timeout::Error){ m.timeout(0.01){ i += 1; sleep } } assert_expired(false, m) i += 1 sleep @@ -34,14 +34,14 @@ class TestWEBrickUtils < Test::Unit::TestCase def test_timeout_default_execption m = WEBrick::Utils - assert_raise(Timeout::Error){ m.timeout(0.1){ sleep } } + assert_raise(Timeout::Error){ m.timeout(0.01){ sleep } } assert_expired(true, m) end def test_timeout_custom_exception m = WEBrick::Utils ex = EX - assert_raise(ex){ m.timeout(0.1, ex){ sleep } } + assert_raise(ex){ m.timeout(0.01, ex){ sleep } } assert_expired(true, m) end @@ -51,7 +51,7 @@ class TestWEBrickUtils < Test::Unit::TestCase i = 0 assert_raise(ex){ m.timeout(10){ - m.timeout(1, ex){ i += 1; sleep } + m.timeout(0.01, ex){ i += 1; sleep } } sleep } @@ -64,8 +64,8 @@ class TestWEBrickUtils < Test::Unit::TestCase ex = EX i = 0 assert_raise(Timeout::Error){ - m.timeout(1){ - m.timeout(10, ex){ i += 1; sleep } + m.timeout(0.01){ + m.timeout(1.0, ex){ i += 1; sleep } } sleep } |