diff options
Diffstat (limited to 'spec/ruby/core/exception')
-rw-r--r-- | spec/ruby/core/exception/signal_exception_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/exception/system_exit_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/exception/top_level_spec.rb | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/spec/ruby/core/exception/signal_exception_spec.rb b/spec/ruby/core/exception/signal_exception_spec.rb index e494e18cde..2d2179a628 100644 --- a/spec/ruby/core/exception/signal_exception_spec.rb +++ b/spec/ruby/core/exception/signal_exception_spec.rb @@ -95,7 +95,7 @@ describe "SignalException" do platform_is_not :windows do it "runs after at_exit" do - output = ruby_exe(<<-RUBY) + output = ruby_exe(<<-RUBY, exit_status: nil) at_exit do puts "hello" $stdout.flush @@ -109,7 +109,7 @@ describe "SignalException" do end it "cannot be trapped with Signal.trap" do - ruby_exe(<<-RUBY) + ruby_exe(<<-RUBY, exit_status: nil) Signal.trap("PROF") {} raise(SignalException, "PROF") RUBY @@ -118,7 +118,7 @@ describe "SignalException" do end it "self-signals for USR1" do - ruby_exe("raise(SignalException, 'USR1')") + ruby_exe("raise(SignalException, 'USR1')", exit_status: nil) $?.termsig.should == Signal.list.fetch('USR1') end end diff --git a/spec/ruby/core/exception/system_exit_spec.rb b/spec/ruby/core/exception/system_exit_spec.rb index 5c6116576b..eef9faf271 100644 --- a/spec/ruby/core/exception/system_exit_spec.rb +++ b/spec/ruby/core/exception/system_exit_spec.rb @@ -3,14 +3,14 @@ require_relative '../../spec_helper' describe "SystemExit" do it "sets the exit status and exits silently when raised" do code = 'raise SystemExit.new(7)' - result = ruby_exe(code, args: "2>&1") + result = ruby_exe(code, args: "2>&1", exit_status: 7) result.should == "" $?.exitstatus.should == 7 end it "sets the exit status and exits silently when raised when subclassed" do code = 'class CustomExit < SystemExit; end; raise CustomExit.new(8)' - result = ruby_exe(code, args: "2>&1") + result = ruby_exe(code, args: "2>&1", exit_status: 8) result.should == "" $?.exitstatus.should == 8 end diff --git a/spec/ruby/core/exception/top_level_spec.rb b/spec/ruby/core/exception/top_level_spec.rb index 501c7253c3..5c4514f694 100644 --- a/spec/ruby/core/exception/top_level_spec.rb +++ b/spec/ruby/core/exception/top_level_spec.rb @@ -2,7 +2,7 @@ require_relative '../../spec_helper' describe "An Exception reaching the top level" do it "is printed on STDERR" do - ruby_exe('raise "foo"', args: "2>&1").should.include?("in `<main>': foo (RuntimeError)") + ruby_exe('raise "foo"', args: "2>&1", exit_status: 1).should.include?("in `<main>': foo (RuntimeError)") end ruby_version_is "2.6" do @@ -20,7 +20,7 @@ describe "An Exception reaching the top level" do raise_wrapped end RUBY - lines = ruby_exe(code, args: "2>&1").lines + lines = ruby_exe(code, args: "2>&1", exit_status: 1).lines lines.reject! { |l| l.include?('rescue in') } lines.map! { |l| l.chomp[/:(in.+)/, 1] } lines.should == ["in `raise_wrapped': wrapped (RuntimeError)", @@ -38,7 +38,7 @@ describe "An Exception reaching the top level" do "/dir/bar.rb:20:in `caller'", ] RUBY - ruby_exe(code, args: "2>&1").should == <<-EOS + ruby_exe(code, args: "2>&1", exit_status: 1).should == <<-EOS /dir/foo.rb:10:in `raising': foo (RuntimeError) \tfrom /dir/bar.rb:20:in `caller' EOS |