Skip to content

Commit 72e93c5

Browse files
committed
Add a spec to check $! is set when raising an exception from C.
1 parent a0a25ed commit 72e93c5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/ruby/optional/capi/exception_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@
3636
runtime_error.set_backtrace []
3737
-> { @s.rb_exc_raise(runtime_error) }.should raise_error(RuntimeError, '42')
3838
end
39+
40+
it "sets $! to the raised exception" do
41+
runtime_error = RuntimeError.new '42'
42+
runtime_error.set_backtrace []
43+
begin
44+
@s. rb_exc_raise(runtime_error)
45+
rescue
46+
$!.should == runtime_error
47+
end
48+
end
3949
end
4050

4151
describe "rb_errinfo" do

0 commit comments

Comments
 (0)