[ruby/irb] Fix irb:rdbg for ruby head

(https://github.com/ruby/irb/pull/876)

* Update binding.irb check for Ruby head

With https://github.com/ruby/ruby/pull/9605, backtrace in Ruby head
now has a new format. This commit updates the check for binding.irb
to work with Ruby head.

* Do not include a backtick in error messages and backtraces

[Feature #16495]

---------

https://github.com/ruby/irb/commit/ebffd3d976

Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
This commit is contained in:
Stan Lo 2024-02-16 14:30:22 +00:00 committed by Hiroshi SHIBATA
parent 9ec9910081
commit 7e577e150a
2 changed files with 6 additions and 6 deletions

View File

@ -11,7 +11,7 @@ module IRB
BINDING_IRB_FRAME_REGEXPS = [
'<internal:prelude>',
binding.method(:irb).source_location.first,
].map { |file| /\A#{Regexp.escape(file)}:\d+:in `irb'\z/ }
].map { |file| /\A#{Regexp.escape(file)}:\d+:in (`|'Binding#)irb'\z/ }
def execute(pre_cmds: nil, do_cmds: nil)
if irb_context.with_debugger

View File

@ -72,7 +72,7 @@ module TestIRB
expected_output =
if RUBY_3_4
[
:*, /\(irb\):1:in '<top \(required\)>': Foo \(RuntimeError\)\n/,
:*, /\(irb\):1:in '<main>': Foo \(RuntimeError\)\n/,
:*, /#<RuntimeError: Foo>\n/,
:*, /0$/,
:*, /0$/,
@ -107,8 +107,8 @@ module TestIRB
expected_output =
if RUBY_3_4
[
:*, /\(irb\):1:in '<top \(required\)>': Foo \(RuntimeError\)\n/,
:*, /\(irb\):2:in '<top \(required\)>': Bar \(RuntimeError\)\n/,
:*, /\(irb\):1:in '<main>': Foo \(RuntimeError\)\n/,
:*, /\(irb\):2:in '<main>': Bar \(RuntimeError\)\n/,
:*, /#<RuntimeError: Bar>\n/,
]
else
@ -531,7 +531,7 @@ module TestIRB
[
:*, /\(irb\):1:in 'fuga': unhandled exception\n/,
:*, /\tfrom \(irb\):1:in 'hoge'\n/,
:*, /\tfrom \(irb\):1:in '<top \(required\)>'\n/,
:*, /\tfrom \(irb\):1:in '<main>'\n/,
:*
]
elsif RUBY_VERSION < '3.0.0' && STDOUT.tty?
@ -569,7 +569,7 @@ module TestIRB
[
:*, /\(irb\):1:in 'fuga': A\\xF3B \(RuntimeError\)\n/,
:*, /\tfrom \(irb\):1:in 'hoge'\n/,
:*, /\tfrom \(irb\):1:in '<top \(required\)>'\n/,
:*, /\tfrom \(irb\):1:in '<main>'\n/,
:*
]
elsif RUBY_VERSION < '3.0.0' && STDOUT.tty?