diff --git a/lib/irb/debug.rb b/lib/irb/debug.rb index e429eaaff..0225a8a50 100644 --- a/lib/irb/debug.rb +++ b/lib/irb/debug.rb @@ -49,7 +49,7 @@ def setup(irb) def DEBUGGER__.capture_frames(*args) frames = capture_frames_without_irb(*args) frames.reject! do |frame| - frame.realpath&.start_with?(IRB_DIR) || frame.path == "" + frame.realpath&.start_with?(IRB_DIR) || frame.path.start_with?("= "3.3.0" + expected_traces = if RUBY_VERSION >= "3.5.0" + [ + /from .*\/irbtest-.*.rb:6:in (`|'Object#)bar'/, + /from .*\/irbtest-.*.rb\(irb\):1:in [`']
'/, + /from .*\/irbtest-.*.rb:9:in (`|'Binding#)irb'/, + /from .*\/irbtest-.*.rb:9:in [`']
'/ + ] + elsif RUBY_VERSION >= "3.3.0" [ /from .*\/irbtest-.*.rb:6:in (`|'Object#)bar'/, /from .*\/irbtest-.*.rb\(irb\):1:in [`']
'/, @@ -934,11 +941,20 @@ def bar assert_match(/irbtest-.*\.rb:2:in (`|'Object#)foo': error \(RuntimeError\)/, output) frame_traces = output.split("\n").map(&:strip).grep(/from /) - expected_traces = [ - /from .*\/irbtest-.*.rb:6:in (`|'Object#)bar'/, - /from .*\/irbtest-.*.rb\(irb\):1:in [`']
'/, - /from .*\/irbtest-.*.rb:9:in [`']
'/ - ] + expected_traces = if RUBY_VERSION >= "3.5.0" + [ + /from .*\/irbtest-.*.rb:6:in (`|'Object#)bar'/, + /from .*\/irbtest-.*.rb\(irb\):1:in [`']
'/, + /from .*\/irbtest-.*.rb:9:in (`|'Binding#)irb'/, + /from .*\/irbtest-.*.rb:9:in [`']
'/ + ] + else + [ + /from .*\/irbtest-.*.rb:6:in (`|'Object#)bar'/, + /from .*\/irbtest-.*.rb\(irb\):1:in [`']
'/, + /from .*\/irbtest-.*.rb:9:in [`']
'/ + ] + end expected_traces.reverse! if RUBY_VERSION < "3.0.0"