diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-27 08:18:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-27 08:18:50 +0000 |
commit | ba57274860e05b2738419d462464a699d3ef4463 (patch) | |
tree | c7eac92dd5a9feedbe402d83a9f2f500bc8c171c /test/test_timeout.rb | |
parent | 8ef0192103f9edc4a7193f635a27206b56944637 (diff) | |
download | ruby-ba57274860e05b2738419d462464a699d3ef4463.tar.gz |
timeout.rb: raise given exception
* lib/timeout.rb (Timeout#timeout): skip rescue clause only when no
exception class is given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_timeout.rb')
-rw-r--r-- | test/test_timeout.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/test_timeout.rb b/test/test_timeout.rb index 4c6065c232..9d51ca5be3 100644 --- a/test/test_timeout.rb +++ b/test/test_timeout.rb @@ -33,7 +33,7 @@ class TestTimeout < Test::Unit::TestCase def test_skip_rescue bug8730 = '[Bug #8730]' e = nil - assert_raise(Timeout::Error, bug8730) do + assert_raise_with_message(Timeout::Error, /execution expired/, bug8730) do timeout 0.1 do begin sleep 3 @@ -43,4 +43,18 @@ class TestTimeout < Test::Unit::TestCase end assert_nil(e, bug8730) end + + def test_rescue_exit + exc = Class.new(RuntimeError) + e = nil + assert_nothing_raised(exc) do + timeout 0.1, exc do + begin + sleep 3 + rescue exc => e + end + end + end + assert_raise_with_message(exc, /execution expired/) {raise e if e} + end end |