From 3e9e4a6a96758a3bfbdf7054419a054f00c1d6b6 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 8 Jan 2014 04:12:39 +0000 Subject: lib/timeout.rb: fallback to Timeout::Error * lib/timeout.rb (Timeout::ExitException.catch): pass arguments for new instance. * lib/timeout.rb (Timeout::ExitException#exception): fallback to Timeout::Error if couldn't throw. [ruby-dev:47872] [Bug #9380] * lib/timeout.rb (Timeout#timeout): initialize ExitException with message for the fallback case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/test_timeout.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/test_timeout.rb') diff --git a/test/test_timeout.rb b/test/test_timeout.rb index c0d6e1bf65..117c1402fa 100644 --- a/test/test_timeout.rb +++ b/test/test_timeout.rb @@ -75,4 +75,15 @@ class TestTimeout < Test::Unit::TestCase end end end + + def test_enumerator_next + bug9380 = '[ruby-dev:47872] [Bug #9380]: timeout in Enumerator#next' + e = (o=Object.new).to_enum + def o.each + sleep + end + assert_raise_with_message(Timeout::Error, 'execution expired', bug9380) do + Timeout.timeout(0.01) {e.next} + end + end end -- cgit v1.2.3