summaryrefslogtreecommitdiff
path: root/spec/ruby/core/exception
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2024-02-15 16:00:51 +0900
committerYusuke Endoh <mame@ruby-lang.org>2024-02-15 19:11:58 +0900
commit8f2c231642c9f94947b75769d3cc21b1127b2135 (patch)
tree81e26f9add3eda627f945fb492f791f92dbdb197 /spec/ruby/core/exception
parent9d1b000bd1bb747bcc49e2d7677fb7c2b31c5a94 (diff)
ruby-spec: Accept the receiver in backtraces
Diffstat (limited to 'spec/ruby/core/exception')
-rw-r--r--spec/ruby/core/exception/backtrace_spec.rb2
-rw-r--r--spec/ruby/core/exception/top_level_spec.rb12
2 files changed, 7 insertions, 7 deletions
diff --git a/spec/ruby/core/exception/backtrace_spec.rb b/spec/ruby/core/exception/backtrace_spec.rb
index bce6c95175..9a65ea3820 100644
--- a/spec/ruby/core/exception/backtrace_spec.rb
+++ b/spec/ruby/core/exception/backtrace_spec.rb
@@ -27,7 +27,7 @@ describe "Exception#backtrace" do
end
it "includes the name of the method from where self raised in the first element" do
- @backtrace.first.should =~ /in [`']backtrace'/
+ @backtrace.first.should =~ /in [`'](?:ExceptionSpecs::Backtrace\.)?backtrace'/
end
it "includes the filename of the location immediately prior to where self raised in the second element" do
diff --git a/spec/ruby/core/exception/top_level_spec.rb b/spec/ruby/core/exception/top_level_spec.rb
index 8a1e3b92f9..6ef7539598 100644
--- a/spec/ruby/core/exception/top_level_spec.rb
+++ b/spec/ruby/core/exception/top_level_spec.rb
@@ -20,13 +20,13 @@ describe "An Exception reaching the top level" do
end
RUBY
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.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/
+ lines.size.should == 5
+ lines[0].should =~ /\Ain [`'](?:Object#)?raise_wrapped': wrapped \(RuntimeError\)\z/
+ lines[1].should =~ /\Ain [`'](?:rescue in )?<main>'\z/
+ lines[2].should =~ /\Ain [`']<main>'\z/
+ lines[3].should =~ /\Ain [`'](?:Object#)?raise_cause': the cause \(RuntimeError\)\z/
+ lines[4].should =~ /\Ain [`']<main>'\z/
end
describe "with a custom backtrace" do