diff options
author | Eric Wong <normalperson@yhbt.net> | 2015-01-12 08:27:41 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-01-16 20:05:29 +0000 |
commit | 060ec9240134bc759d3966360a79825743e3de16 (patch) | |
tree | e3306d1877236d1634b60ab563ba1c24236e5852 /test | |
parent | 15a1f2100a09cef45fd17c283e3b784bd8031c9a (diff) | |
download | ruby_posix_mq-060ec9240134bc759d3966360a79825743e3de16.tar.gz |
If a corresponding IO object exists or is created later, propagate autoclose to the corresponding IO object to avoid simplify autoclose handling for the user. This hopefully avoids nasty surprises in case users disable autoclose but want to keep the IO object around.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_posix_mq.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_posix_mq.rb b/test/test_posix_mq.rb index a4fc407..35967e8 100644 --- a/test/test_posix_mq.rb +++ b/test/test_posix_mq.rb @@ -258,6 +258,14 @@ class Test_POSIX_MQ < Test::Unit::TestCase end end if POSIX_MQ.respond_to?(:for_fd) && POSIX_MQ.method_defined?(:to_io) + def test_autoclose_propagates_to_io + @mq = POSIX_MQ.new @path, IO::CREAT|IO::RDWR, 0666 + @mq.autoclose = false + assert_equal false, @mq.to_io.autoclose? + @mq.autoclose = true + assert_equal true, @mq.to_io.autoclose? + end if POSIX_MQ.method_defined?(:to_io) + def test_notify rd, wr = IO.pipe orig = trap(:USR1) { wr.syswrite('.') } |