From ea2dec6f461b3a02a6a9d1c508a0e5305ce9b611 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 20 Aug 2024 14:35:57 -0400 Subject: [PATCH] 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. --- test/test_tempfile.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/test_tempfile.rb b/test/test_tempfile.rb index 1e40e4e..8077cc3 100644 --- a/test/test_tempfile.rb +++ b/test/test_tempfile.rb @@ -175,7 +175,7 @@ def test_close_bang_does_not_unlink_if_already_unlinked 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 @@ def test_finalizer_removes_file 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 @@ def test_finalizer_removes_file_when_dup 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 @@ def test_finalizer_removes_file_when_clone 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 @@ def test_finalizer_does_not_unlink_if_already_unlinked 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 @@ def test_close_flushes_buffer 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 @@ def test_tempfile_is_unlinked_when_ruby_exits 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