preliminary kqueue support
[sleepy_penguin.git] / test / test_epoll_io.rb
bloba899e0d86ebce98830571d6ce191d500567a4bc8
1 require 'test/unit'
2 require 'fcntl'
3 require 'socket'
4 require 'thread'
5 $-w = true
6 Thread.abort_on_exception = true
7 require 'sleepy_penguin'
9 class TestEpollIO < Test::Unit::TestCase
10   include SleepyPenguin
11   RBX = defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'rbx')
13   def setup
14     @rd, @wr = IO.pipe
15     @epio = Epoll::IO.new(nil)
16   end
18   def test_add_wait
19     @epio.epoll_ctl(Epoll::CTL_ADD, @wr, Epoll::OUT)
20     ev = []
21     @epio.epoll_wait { |events, obj| ev << [ events, obj ] }
22     assert_equal([[Epoll::OUT, @wr]], ev)
23   end
24 end if defined?(SleepyPenguin::Epoll)