summaryrefslogtreecommitdiff
path: root/test/test_timeout.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2022-05-12 16:20:56 +0200
committergit <svn-admin@ruby-lang.org>2022-05-19 07:19:39 +0900
commit89fbec224d8e1fa35e82bf2712c5a5fd3dc06b83 (patch)
tree9beaa3430a7c8f91c41a8fc12f2b616c4a4332da /test/test_timeout.rb
parent97c12c5f692d176278dd6445a751788568b54e4d (diff)
downloadruby-89fbec224d8e1fa35e82bf2712c5a5fd3dc06b83.tar.gz
[ruby/timeout] Reimplement Timeout.timeout with a single thread and a Queue
https://github.com/ruby/timeout/commit/2bafc458f1
Diffstat (limited to 'test/test_timeout.rb')
-rw-r--r--test/test_timeout.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_timeout.rb b/test/test_timeout.rb
index 74b65f119d..58eb8421db 100644
--- a/test/test_timeout.rb
+++ b/test/test_timeout.rb
@@ -10,6 +10,18 @@ class TestTimeout < Test::Unit::TestCase
end
end
+ def test_included
+ c = Class.new do
+ include Timeout
+ def test
+ timeout(1) { :ok }
+ end
+ end
+ assert_nothing_raised do
+ assert_equal :ok, c.new.test
+ end
+ end
+
def test_yield_param
assert_equal [5, :ok], Timeout.timeout(5){|s| [s, :ok] }
end
@@ -43,6 +55,7 @@ class TestTimeout < Test::Unit::TestCase
begin
sleep 3
rescue Exception => e
+ flunk "should not see any exception but saw #{e.inspect}"
end
end
end