From aa4958b713e3979af863410f410d2529fe6764c2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 8 May 2013 22:07:43 +0000 Subject: test_epoll_io: ensure subclassing Epoll::IO works A subclass may want to set CLOEXEC by default. --- test/test_epoll_io.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) -- cgit v1.2.3-24-ge0c7