about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-05-08 22:07:43 +0000
committerEric Wong <normalperson@yhbt.net>2013-05-15 19:26:27 +0000
commitaa4958b713e3979af863410f410d2529fe6764c2 (patch)
tree91683dddb38f2fe417b594a6584cc1946b6b73ad
parent5a757f1515d4131ad4f6f1203dd6a117a9005d4f (diff)
downloadsleepy_penguin-aa4958b713e3979af863410f410d2529fe6764c2.tar.gz
A subclass may want to set CLOEXEC by default.
-rw-r--r--test/test_epoll_io.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_epoll_io.rb b/test/test_epoll_io.rb
index daaa229..05a0613 100644
--- a/test/test_epoll_io.rb
+++ b/test/test_epoll_io.rb
@@ -20,4 +20,16 @@ class TestEpollIO < Test::Unit::TestCase
     @epio.epoll_wait { |events, obj| ev << [ events, obj ] }
     assert_equal([[Epoll::OUT, @wr]], ev)
   end
+
+  class EpSub < Epoll::IO
+    def self.new
+      super(SleepyPenguin::Epoll::CLOEXEC)
+    end
+  end
+
+  def test_subclass
+    tmp = EpSub.new
+    assert_equal Fcntl::FD_CLOEXEC, tmp.fcntl(Fcntl::F_GETFD)
+    assert_nil tmp.close
+  end
 end if defined?(SleepyPenguin::Epoll)