summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2024-07-25 13:03:12 -0400
committerPeter Zhu <[email protected]>2024-07-25 15:25:37 -0400
commit54ff3d69966e194460c0a64e76cd4d48ddf1673d (patch)
tree6a44e3449dc9c5e5af4f37498aaab983185dcd99 /test
parent24770c30f87fff758e94cc4d1293cdb8c64ce8f4 (diff)
Fix test_kwarg_eval_memory_leak
Hash.new no longer takes keyword arguments except for capacity, so we should just use a method that takes keyword arguments instead.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11246
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_method.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index a355f86a17..91f4b99181 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -1618,8 +1618,11 @@ class TestMethod < Test::Unit::TestCase
def test_kwarg_eval_memory_leak
assert_no_memory_leak([], "", <<~RUBY, rss: true, limit: 1.2)
+ obj = Object.new
+ def obj.test(**kwargs) = nil
+
100_000.times do
- eval("Hash.new(foo: 123)")
+ eval("obj.test(foo: 123)")
end
RUBY
end