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.
This commit is contained in:
Peter Zhu 2024-07-25 13:03:12 -04:00
Родитель 24770c30f8
Коммит 54ff3d6996
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -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