summaryrefslogtreecommitdiff
path: root/spec/ruby/core/exception/top_level_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/exception/top_level_spec.rb')
-rw-r--r--spec/ruby/core/exception/top_level_spec.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/ruby/core/exception/top_level_spec.rb b/spec/ruby/core/exception/top_level_spec.rb
index bcd09205b6..8a1e3b92f9 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", exit_status: 1).should.include?("in `<main>': foo (RuntimeError)")
+ ruby_exe('raise "foo"', args: "2>&1", exit_status: 1).should =~ /in [`']<main>': foo \(RuntimeError\)/
end
it "the Exception#cause is printed to STDERR with backtraces" do
@@ -22,10 +22,11 @@ describe "An Exception reaching the top level" do
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)",
- "in `<main>'",
- "in `raise_cause': the cause (RuntimeError)",
- "in `<main>'"]
+ lines.size.should == 4
+ lines[0].should =~ /\Ain [`']raise_wrapped': wrapped \(RuntimeError\)\z/
+ lines[1].should =~ /\Ain [`']<main>'\z/
+ lines[2].should =~ /\Ain [`']raise_cause': the cause \(RuntimeError\)\z/
+ lines[3].should =~ /\Ain [`']<main>'\z/
end
describe "with a custom backtrace" do