summaryrefslogtreecommitdiff
path: root/test/test_timeout.rb
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-04-20 10:34:11 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-05-06 16:49:26 +0900
commit33b5e179a88e67f1ee12e2e8993121b2f445b54f (patch)
tree1fb74a99fbe9c9b57280ac224dcef17e34346738 /test/test_timeout.rb
parenta42b7de436cfceb0d6607651a3a7bf4fbd887416 (diff)
downloadruby-33b5e179a88e67f1ee12e2e8993121b2f445b54f.tar.gz
[ruby/timeout] Make Timeout::Error#exception with multiple arguments not ignore arguments
This makes: raise(Timeout::Error.new("hello"), "world") raise a TimeoutError instance with "world" as the message instead of "hello", for consistency with other Ruby exception classes. This required some internal changes to keep the tests passing. Fixes [Bug #17812] https://github.com/ruby/timeout/commit/952154dbf9
Diffstat (limited to 'test/test_timeout.rb')
-rw-r--r--test/test_timeout.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_timeout.rb b/test/test_timeout.rb
index c57d90c063..71607ed680 100644
--- a/test/test_timeout.rb
+++ b/test/test_timeout.rb
@@ -80,6 +80,14 @@ class TestTimeout < Test::Unit::TestCase
end
end
+ def test_raise_with_message
+ bug17812 = '[ruby-core:103502] [Bug #17812]: Timeout::Error doesn\'t let two-argument raise() set a new message'
+ exc = Timeout::Error.new('foo')
+ assert_raise_with_message(Timeout::Error, 'bar', bug17812) do
+ raise exc, 'bar'
+ end
+ end
+
def test_enumerator_next
bug9380 = '[ruby-dev:47872] [Bug #9380]: timeout in Enumerator#next'
e = (o=Object.new).to_enum