Skip to content

Commit 6de02d8

Browse files
committed
Add a spec for rb_rescue2 when the arguments are incorrect
(cherry picked from commit adc9bf1)
1 parent 12f57d1 commit 6de02d8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

spec/ruby/optional/capi/kernel_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,14 @@ def proc_caller
403403
@s.rb_rescue2(type_error_proc, :no_exc, proc, :exc, ArgumentError, RuntimeError)
404404
}.should raise_error(Exception, 'custom error')
405405
end
406+
407+
ruby_bug "#17305", ""..."2.7" do
408+
it "raises TypeError if one of the passed exceptions is not a Module" do
409+
-> {
410+
@s.rb_rescue2(-> *_ { raise RuntimeError, "foo" }, :no_exc, -> x { x }, :exc, Object.new, 42)
411+
}.should raise_error(TypeError, /class or module required/)
412+
end
413+
end
406414
end
407415

408416
describe "rb_catch" do

0 commit comments

Comments
 (0)