splice.c: remove reference to non-existent function
[sleepy_penguin.git] / test / test_epoll_io.rb
blobd749158a02a1b3bca5fe8bf149f31420a5c4c85a
1 require_relative 'helper'
2 require 'fcntl'
3 require 'socket'
4 require 'thread'
6 class TestEpollIO < Test::Unit::TestCase
7   include SleepyPenguin
9   def setup
10     @rd, @wr = IO.pipe
11     @epio = Epoll::IO.new(nil)
12   end
14   def test_add_wait
15     @epio.epoll_ctl(Epoll::CTL_ADD, @wr, Epoll::OUT)
16     ev = []
17     @epio.epoll_wait { |events, obj| ev << [ events, obj ] }
18     assert_equal([[Epoll::OUT, @wr]], ev)
19   end
21   class EpSub < Epoll::IO
22     def self.new
23       super(:CLOEXEC)
24     end
25   end
27   def test_subclass
28     tmp = EpSub.new
29     assert_equal Fcntl::FD_CLOEXEC, tmp.fcntl(Fcntl::F_GETFD)
30     assert_nil tmp.close
31   end
32 end if defined?(SleepyPenguin::Epoll)