1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-05-28 22:41:48 +02:00
parent d070523e7b
commit a66bc2c011
41 changed files with 699 additions and 639 deletions

View file

@ -292,6 +292,22 @@ describe "C-API Kernel function" do
end
end
describe "rb_eval_string_protect" do
it "will evaluate the given string" do
proof = []
res = @s.rb_eval_string_protect('1 + 7', proof)
proof.should == [23, 8]
end
it "will allow cleanup code to be run when an exception is raised" do
proof = []
lambda do
@s.rb_eval_string_protect('raise RuntimeError', proof)
end.should raise_error(RuntimeError)
proof.should == [23, nil]
end
end
describe "rb_rescue" do
before :each do
@proc = lambda { |x| x }