Skip to content

Commit 74cb6c5

Browse files
committed
Fix ruby head test failures due to Class#new inlining caller changes
1 parent a4fed7c commit 74cb6c5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/test_retained_memory.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,14 @@ def test_tracing_retained_objects
4545
top_stack_tally = result.samples.tally.max_by(&:last)
4646
top_stack = result.stack(top_stack_tally.first)
4747

48-
assert_equal "Class#new", top_stack.frames[0].label
49-
assert_equal "#{self.class}##{__method__}", top_stack.frames[1].label
48+
# https://bugs.ruby-lang.org/issues/21254
49+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.5.0")
50+
assert_equal "#{self.class}##{__method__}", top_stack.frames[0].label
51+
assert_equal "Integer#times", top_stack.frames[1].label
52+
else
53+
assert_equal "Class#new", top_stack.frames[0].label
54+
assert_equal "#{self.class}##{__method__}", top_stack.frames[1].label
55+
end
5056
end
5157

5258
def test_empty_block

0 commit comments

Comments
 (0)