summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2025-12-02 16:37:43 -0800
committerJohn Hawthorn <john@hawthorn.email>2025-12-02 18:53:10 -0800
commitb8a7988478bfa8faff7a6f36e5dd22f6f98872b7 (patch)
tree3cff8df3d16fd71421173daaf43bb8553926928c /test/ruby
parent65cfd5e13beca200e834d92132a3c8aa86578c98 (diff)
Avoid leaking fd in uminus_no_embed test
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_string.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index e2384e1500..50dc5ec2f9 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -3443,9 +3443,11 @@ CODE
def test_uminus_no_embed_gc
pad = "a"*2048
- ("aa".."zz").each do |c|
- fstr = -(c + pad).freeze
- File.open(IO::NULL, "w").write(fstr)
+ File.open(IO::NULL, "w") do |dev_null|
+ ("aa".."zz").each do |c|
+ fstr = -(c + pad).freeze
+ dev_null.write(fstr)
+ end
end
GC.start
end