diff options
author | Samuel Williams <[email protected]> | 2023-12-27 00:36:56 +1300 |
---|---|---|
committer | GitHub <[email protected]> | 2023-12-27 00:36:56 +1300 |
commit | e5a4f757bdf5dc3d8c329ddd268432f9ecc7bff6 (patch) | |
tree | 55d01a7b891eda32e36b1f18e69ee6c1be8d0e7e /test/ruby/test_io_buffer.rb | |
parent | b1f67cf08eb0aaadfdc6893034b0653551141a10 (diff) |
Fix Window private file mapping unlink EACCES issue. (#9358)
* Don't return early.
* Add missing `mapping` assignment.
* Make debug logs conditional.
Diffstat (limited to 'test/ruby/test_io_buffer.rb')
-rw-r--r-- | test/ruby/test_io_buffer.rb | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/test/ruby/test_io_buffer.rb b/test/ruby/test_io_buffer.rb index b4b63b1eda..321b6534ee 100644 --- a/test/ruby/test_io_buffer.rb +++ b/test/ruby/test_io_buffer.rb @@ -521,24 +521,20 @@ class TestIOBuffer < Test::Unit::TestCase def test_private Tempfile.create(%w"buffer .txt") do |file| file.write("Hello World") - file.close - assert_separately(["-W0", "-", file.path], "#{<<-"begin;"}\n#{<<-'end;'}") - begin; - file = File.open(ARGV[0], "r+") - buffer = IO::Buffer.map(file, nil, 0, IO::Buffer::PRIVATE) - begin - assert buffer.private? - refute buffer.readonly? - - buffer.set_string("J") - - # It was not changed because the mapping was private: - file.seek(0) - assert_equal "Hello World", file.read - ensure - buffer&.free - end - end; + + buffer = IO::Buffer.map(file, nil, 0, IO::Buffer::PRIVATE) + begin + assert buffer.private? + refute buffer.readonly? + + buffer.set_string("J") + + # It was not changed because the mapping was private: + file.seek(0) + assert_equal "Hello World", file.read + ensure + buffer&.free + end end end end |