diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2022-10-19 18:53:38 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-19 18:53:38 +1300 |
commit | fc3137ef54562c3c3290245c0f62e0bb193c3145 (patch) | |
tree | 65db334b4c606747eb2da3fd61ea80ef7aede423 /test/ruby | |
parent | f982a26374f4300ed9e5cbd122f792f907e20b22 (diff) | |
download | ruby-fc3137ef54562c3c3290245c0f62e0bb193c3145.tar.gz |
Add support for anonymous shared IO buffers. (#6580)
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_io_buffer.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_io_buffer.rb b/test/ruby/test_io_buffer.rb index 95ed98e1f4..2204c3db09 100644 --- a/test/ruby/test_io_buffer.rb +++ b/test/ruby/test_io_buffer.rb @@ -403,4 +403,19 @@ class TestIOBuffer < Test::Unit::TestCase assert_equal IO::Buffer.for("\x00\x01\x004\x00\x01\x004\x00\x01"), source.dup.xor!(mask) assert_equal IO::Buffer.for("\xce\xcd\xcc\xcb\xce\xcd\xcc\xcb\xce\xcd"), source.dup.not! end + + def test_shared + message = "Hello World" + buffer = IO::Buffer.new(64, IO::Buffer::MAPPED | IO::Buffer::SHARED) + + pid = fork do + buffer.set_string(message) + end + + Process.wait(pid) + string = buffer.get_string(0, message.bytesize) + assert_equal message, string + rescue NotImplementedError + omit "Fork/shared memory is not supported." + end end |