diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-10 17:08:37 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-10 17:08:37 +0000 |
commit | 40270906824a981652719c5e614c2cf4d1c234b0 (patch) | |
tree | 0a3c3021b0a3106d808455e1b15b918206abb2cc /test | |
parent | 3b90cf70d17b5441a83b7ccb1aa0ff2e8b2f5bbc (diff) |
merge revision(s) 51213: [Backport #11344]
* lib/timeout.rb (ExitException): removed internal exception class
and use Timeout::Error instead, as using throw/catch to isolate
each timeouts now. [ruby-dev:49179] [Bug #11344]
* lib/timeout.rb (ExitException): leave Timeout::ExitException as an
alias of Timeout::Error for backward compatibility in stable branch.
[ruby-dev:49179] [Bug #11344]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/test_timeout.rb | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/test/test_timeout.rb b/test/test_timeout.rb index e71a09f22c..e4eba7f902 100644 --- a/test/test_timeout.rb +++ b/test/test_timeout.rb @@ -63,9 +63,9 @@ class TestTimeout < Test::Unit::TestCase end def test_exit_exception - assert_raise_with_message(Timeout::ExitException, "boon") do - Timeout.timeout(10, Timeout::ExitException) do - raise Timeout::ExitException, "boon" + assert_raise_with_message(Timeout::Error, "boon") do + Timeout.timeout(10, Timeout::Error) do + raise Timeout::Error, "boon" end end end @@ -80,4 +80,21 @@ class TestTimeout < Test::Unit::TestCase Timeout.timeout(0.01) {e.next} end end + + def test_handle_interrupt + bug11344 = '[ruby-dev:49179] [Bug #11344]' + ok = false + assert_raise(Timeout::Error) { + Thread.handle_interrupt(Timeout::Error => :never) { + Timeout.timeout(0.01) { + sleep 0.2 + ok = true + Thread.handle_interrupt(Timeout::Error => :on_blocking) { + sleep 0.2 + } + } + } + } + assert(ok, bug11344) + end end |