[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:
parent
2f67610f6b
commit
bd7eda6038
@ -175,7 +175,7 @@ class TestTempfile < Test::Unit::TestCase
|
|||||||
end unless /mswin|mingw/ =~ RUBY_PLATFORM
|
end unless /mswin|mingw/ =~ RUBY_PLATFORM
|
||||||
|
|
||||||
def test_finalizer_removes_file
|
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")
|
file = Tempfile.new("foo")
|
||||||
puts file.path
|
puts file.path
|
||||||
RUBY
|
RUBY
|
||||||
@ -185,7 +185,7 @@ class TestTempfile < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_finalizer_removes_file_when_dup
|
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 = Tempfile.new("foo")
|
||||||
file.dup
|
file.dup
|
||||||
puts file.path
|
puts file.path
|
||||||
@ -196,7 +196,7 @@ class TestTempfile < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_finalizer_removes_file_when_clone
|
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 = Tempfile.new("foo")
|
||||||
file.clone
|
file.clone
|
||||||
puts file.path
|
puts file.path
|
||||||
@ -207,7 +207,7 @@ class TestTempfile < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_finalizer_does_not_unlink_if_already_unlinked
|
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')
|
file = Tempfile.new('foo')
|
||||||
path = file.path
|
path = file.path
|
||||||
puts path
|
puts path
|
||||||
@ -219,7 +219,7 @@ File.open(path, "w").close
|
|||||||
assert_nil error
|
assert_nil error
|
||||||
end
|
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')
|
file = Tempfile.new('foo')
|
||||||
path = file.path
|
path = file.path
|
||||||
file.unlink
|
file.unlink
|
||||||
@ -249,7 +249,7 @@ File.open(path, "w").close
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_tempfile_is_unlinked_when_ruby_exits
|
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
|
puts Tempfile.new('foo').path
|
||||||
EOS
|
EOS
|
||||||
assert_file.for("tempfile must not be exist after GC.").not_exist?(filename)
|
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
|
def test_tempfile_finalizer_does_not_run_if_unlinked
|
||||||
bug8768 = '[ruby-core:56521] [Bug #8768]'
|
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')
|
tmp = Tempfile.new('foo')
|
||||||
puts tmp.path
|
puts tmp.path
|
||||||
tmp.close
|
tmp.close
|
||||||
|
Loading…
x
Reference in New Issue
Block a user