about summary refs log tree commit homepage
path: root/test/test_posix_mq.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2015-01-09 04:18:22 +0000
committerEric Wong <normalperson@yhbt.net>2015-01-09 07:36:38 +0000
commitee64574aac7ad08256e2237dd5973d6ebc22a7d6 (patch)
tree9711754329e27c7275df0357b7cd5cb0b49eeea1 /test/test_posix_mq.rb
parent8d10e4aa66f32abd16d9b6ac0049f777be495d6b (diff)
downloadruby_posix_mq-ee64574aac7ad08256e2237dd5973d6ebc22a7d6.tar.gz
These are analogous to the identically-named IO methods and useful
when we're inheriting descriptors (or writing tests for inheriting
descriptors).
Diffstat (limited to 'test/test_posix_mq.rb')
-rw-r--r--test/test_posix_mq.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_posix_mq.rb b/test/test_posix_mq.rb
index 3583022..a4fc407 100644
--- a/test/test_posix_mq.rb
+++ b/test/test_posix_mq.rb
@@ -245,6 +245,17 @@ class Test_POSIX_MQ < Test::Unit::TestCase
     assert_equal @mq.to_io.to_i, @alt.to_io.to_i
     assert_raises(ArgumentError) { @alt.name }
     assert_raises(Errno::EBADF) { POSIX_MQ.for_fd(1) }
+    @alt.autoclose = false
+    assert_equal false, @alt.autoclose?
+
+    # iterate a bunch and hope GC kicks in
+    fd = @mq.to_io.fileno
+    10_000.times do
+      mq = POSIX_MQ.for_fd(fd)
+      assert_equal true, mq.autoclose?
+      mq.autoclose = false
+      assert_equal false, mq.autoclose?
+    end
   end if POSIX_MQ.respond_to?(:for_fd) && POSIX_MQ.method_defined?(:to_io)
 
   def test_notify