summaryrefslogtreecommitdiff
path: root/test/test_timeout.rb
diff options
context:
space:
mode:
authorkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-28 10:10:05 +0000
committerkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-28 10:10:05 +0000
commitf4f3096dd3304d1d4b5e717becc7c15e01d08f19 (patch)
tree89913ff6f396c8e99440fa56fb241a2d696bfac4 /test/test_timeout.rb
parent46f23b51f6f86d7261fed63bec4b06910ca05597 (diff)
downloadruby-f4f3096dd3304d1d4b5e717becc7c15e01d08f19.tar.gz
test/test_timeout.rb (TestTimeout#test_timeout): add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_timeout.rb')
-rw-r--r--test/test_timeout.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/test_timeout.rb b/test/test_timeout.rb
index dfa863b373..9ec9c02a93 100644
--- a/test/test_timeout.rb
+++ b/test/test_timeout.rb
@@ -9,5 +9,18 @@ class TestTimeout < Test::Unit::TestCase
timeout(0.1) { q.pop }
}
end
-end
+ def test_timeout
+ @flag = true
+ Thread.start {
+ sleep 0.1
+ @flag = false
+ }
+ assert_nothing_raised("[ruby-dev:38319]") do
+ Timeout.timeout(1) {
+ nil while @flag
+ }
+ end
+ assert !@flag, "[ruby-dev:38319]"
+ end
+end