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 2021-06-02 14:34:07 +02:00
parent a4fbc7e288
commit 22e2a6a999
66 changed files with 943 additions and 167 deletions

View file

@ -75,25 +75,25 @@ end
describe :process_exit!, shared: true do
it "exits with the given status" do
out = ruby_exe("#{@object}.send(:exit!, 21)", args: '2>&1')
out = ruby_exe("#{@object}.send(:exit!, 21)", args: '2>&1', exit_status: 21)
out.should == ""
$?.exitstatus.should == 21
end
it "exits when called from a thread" do
out = ruby_exe("Thread.new { #{@object}.send(:exit!, 21) }.join; sleep", args: '2>&1')
out = ruby_exe("Thread.new { #{@object}.send(:exit!, 21) }.join; sleep", args: '2>&1', exit_status: 21)
out.should == ""
$?.exitstatus.should == 21
end
it "exits when called from a fiber" do
out = ruby_exe("Fiber.new { #{@object}.send(:exit!, 21) }.resume", args: '2>&1')
out = ruby_exe("Fiber.new { #{@object}.send(:exit!, 21) }.resume", args: '2>&1', exit_status: 21)
out.should == ""
$?.exitstatus.should == 21
end
it "skips at_exit handlers" do
out = ruby_exe("at_exit { STDERR.puts 'at_exit' }; #{@object}.send(:exit!, 21)", args: '2>&1')
out = ruby_exe("at_exit { STDERR.puts 'at_exit' }; #{@object}.send(:exit!, 21)", args: '2>&1', exit_status: 21)
out.should == ""
$?.exitstatus.should == 21
end
@ -107,7 +107,7 @@ describe :process_exit!, shared: true do
end
raise 'original error'
RUBY
out = ruby_exe(code, args: '2>&1')
out = ruby_exe(code, args: '2>&1', exit_status: 21)
out.should == "in at_exit\n$! is RuntimeError:original error\n"
$?.exitstatus.should == 21
end