mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 16:36:20 +08:00
Stub File.unlink without redefining it in the tempfile test
Redefining the method warns under RUBYOPT=-w, which CI uses, and the test expects nothing on stderr. Prepending a module leaves the original method in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
75d5467039
commit
b5245a5d33
1 file changed
+5
-3
Notes:
git
2026-09-26 04:16:41 +00:00
@@ -237,9 +237,11 @@ File.open(path, "w").close
|
||||
|
||||
def test_finalizer_ignores_eacces_on_unlink
|
||||
assert_in_out_err("-r#{LIB_TEMPFILE_RB_PATH}", <<~'RUBY') do |(filename,*), (error,*)|
|
||||
def File.unlink(*)
|
||||
raise Errno::EACCES
|
||||
end
|
||||
File.singleton_class.prepend(Module.new do
|
||||
def unlink(*)
|
||||
raise Errno::EACCES
|
||||
end
|
||||
end)
|
||||
file = Tempfile.new("foo")
|
||||
puts file.path
|
||||
RUBY
|
||||
|
||||
Reference in new issue
Block a user