Fix flaky require test

This commit is contained in:
Luke Gruber 2025-10-28 21:24:02 -04:00 committed by GitHub
parent d17ce4bd05
commit e4219e2742
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
Notes: git 2025-10-29 01:24:32 +00:00
Merged: https://github.com/ruby/ruby/pull/14977

Merged-By: luke-gru <luke.gru@gmail.com>

View File

@ -857,7 +857,13 @@ class TestRequire < Test::Unit::TestCase
def to_path = @path
end
def create_ruby_file = Tempfile.open(["test", ".rb"]).path
FILES = []
def create_ruby_file
file = Tempfile.open(["test", ".rb"])
FILES << file
file.path
end
require MyString.new(create_ruby_file)
$LOADED_FEATURES.unshift(create_ruby_file)