[ruby/tempfile] Fix subprocess tests requires

Using `-rtempfile` requires the tempfile built into Ruby, not the
currently developed one, so the tests aren't testing this tempfile.

https://github.com/ruby/tempfile/commit/ea2dec6f46
This commit is contained in:
Peter Zhu 2024-08-20 14:35:57 -04:00 коммит произвёл git
Родитель 2f67610f6b
Коммит bd7eda6038
1 изменённых файлов: 7 добавлений и 7 удалений

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

@ -175,7 +175,7 @@ class TestTempfile < Test::Unit::TestCase
end unless /mswin|mingw/ =~ RUBY_PLATFORM
def test_finalizer_removes_file
assert_in_out_err(["-r#{LIB_TEMPFILE_RB_PATH}"], <<~RUBY) do |(filename,*), (error,*)|
assert_in_out_err("-r#{LIB_TEMPFILE_RB_PATH}", <<~RUBY) do |(filename,*), (error,*)|
file = Tempfile.new("foo")
puts file.path
RUBY
@ -185,7 +185,7 @@ class TestTempfile < Test::Unit::TestCase
end
def test_finalizer_removes_file_when_dup
assert_in_out_err(["-r#{LIB_TEMPFILE_RB_PATH}"], <<~RUBY) do |(filename,*), (error,*)|
assert_in_out_err("-r#{LIB_TEMPFILE_RB_PATH}", <<~RUBY) do |(filename,*), (error,*)|
file = Tempfile.new("foo")
file.dup
puts file.path
@ -196,7 +196,7 @@ class TestTempfile < Test::Unit::TestCase
end
def test_finalizer_removes_file_when_clone
assert_in_out_err(["-r#{LIB_TEMPFILE_RB_PATH}"], <<~RUBY) do |(filename,*), (error,*)|
assert_in_out_err("-r#{LIB_TEMPFILE_RB_PATH}", <<~RUBY) do |(filename,*), (error,*)|
file = Tempfile.new("foo")
file.clone
puts file.path
@ -207,7 +207,7 @@ class TestTempfile < Test::Unit::TestCase
end
def test_finalizer_does_not_unlink_if_already_unlinked
assert_in_out_err('-rtempfile', <<-'EOS') do |(filename,*), (error,*)|
assert_in_out_err("-r#{LIB_TEMPFILE_RB_PATH}", <<-'EOS') do |(filename,*), (error,*)|
file = Tempfile.new('foo')
path = file.path
puts path
@ -219,7 +219,7 @@ File.open(path, "w").close
assert_nil error
end
assert_in_out_err('-rtempfile', <<-'EOS') do |(filename,*), (error,*)|
assert_in_out_err("-r#{LIB_TEMPFILE_RB_PATH}", <<-'EOS') do |(filename,*), (error,*)|
file = Tempfile.new('foo')
path = file.path
file.unlink
@ -249,7 +249,7 @@ File.open(path, "w").close
end
def test_tempfile_is_unlinked_when_ruby_exits
assert_in_out_err('-rtempfile', <<-'EOS') do |(filename), (error)|
assert_in_out_err("-r#{LIB_TEMPFILE_RB_PATH}", <<-'EOS') do |(filename), (error)|
puts Tempfile.new('foo').path
EOS
assert_file.for("tempfile must not be exist after GC.").not_exist?(filename)
@ -259,7 +259,7 @@ puts Tempfile.new('foo').path
def test_tempfile_finalizer_does_not_run_if_unlinked
bug8768 = '[ruby-core:56521] [Bug #8768]'
assert_in_out_err(%w(-rtempfile), <<-'EOS') do |(filename), (error)|
assert_in_out_err("-r#{LIB_TEMPFILE_RB_PATH}", <<-'EOS') do |(filename), (error)|
tmp = Tempfile.new('foo')
puts tmp.path
tmp.close