8000 Update the expected values of backtraces · mame/irb@ce054ff · GitHub
[go: up one dir, main page]

Skip to content

Commit ce054ff

Browse files
committed
Update the expected values of backtraces
In ruby 3.5, `Kernel#caller_location` will not include `<internal:xxx>` frames. Instead, it will use its caller-side location for an internal frame. ruby/ruby#13238 This change updates the expected values of backtraces in irb test to support the behavior change.
1 parent e91b21f commit ce054ff

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

test/irb/test_irb.rb

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,14 @@ def bar
879879
assert_match(/irbtest-.*\.rb:2:in (`|'Object#)foo': error \(RuntimeError\)/, output)
880880
frame_traces = output.split("\n").select { |line| line.strip.match?(/from /) }.map(&:strip)
881881

882-
expected_traces = if RUBY_VERSION >= "3.3.0"
882+
expected_traces = if RUBY_VERSION >= "3.5.0"
883+
[
884+
/from .*\/irbtest-.*.rb:6:in (`|'Object#)bar'/,
885+
/from .*\/irbtest-.*.rb\(irb\):1:in [`']<main>'/,
886+
/from .*\/irbtest-.*.rb:9:in (`|'Binding#)irb'/,
887+
/from .*\/irbtest-.*.rb:9:in [`']<main>'/
888+
]
889+
elsif RUBY_VERSION >= "3.3.0"
883890
[
884891
/from .*\/irbtest-.*.rb:6:in (`|'Object#)bar'/,
885892
/from .*\/irbtest-.*.rb\(irb\):1:in [`']<main>'/,
@@ -934,11 +941,20 @@ def bar
934941
assert_match(/irbtest-.*\.rb:2:in (`|'Object#)foo': error \(RuntimeError\)/, output)
935942
frame_traces = output.split("\n").select { |line| line.strip.match?(/from /) }.map(&:strip)
936943

937-
expected_traces = [
938-
/from .*\/irbtest-.*.rb:6:in (`|'Object#)bar'/,
939-
/from .*\/irbtest-.*.rb\(irb\):1:in [`']<main>'/,
940-
/from .*\/irbtest-.*.rb:9:in [`']<main>'/
941-
]
944+
expected_traces = if RUBY_VERSION >= "3.5.0"
945+
[
946+
/from .*\/irbtest-.*.rb:6:in (`|'Object#)bar'/,
947+
/from .*\/irbtest-.*.rb\(irb\):1:in [`']<main>'/,
948+
/from .*\/irbtest-.*.rb:9:in (`|'Binding#)irb'/,
949+
/from .*\/irbtest-.*.rb:9:in [`']<main>'/
950+
]
951+
else
952+
[
953+
/from .*\/irbtest-.*.rb:6:in (`|'Object#)bar'/,
954+
/from .*\/irbtest-.*.rb\(irb\):1:in [`']<main>'/,
955+
/from .*\/irbtest-.*.rb:9:in [`']<main>'/
956+
]
957+
end
942958

943959
expected_traces.reverse! if RUBY_VERSION < "3.0.0"
944960

0 commit comments

Comments
 (0)
0