3 Thread.abort_on_exception = true
4 require 'sleepy_penguin'
6 class TestKqueueIO < Test::Unit::TestCase
13 ev = Kevent[rd.fileno, EvFilt::READ, Ev::ADD|Ev::ONESHOT, 0, 0, rd]
20 n = kq.kevent(nil, 1) do |ident,filter,flags,fflags,data,udata|
21 events << [ ident,filter,flags,fflags,data,udata ]
23 assert_equal 1, events.size
24 assert_equal rd.fileno, events[0][0]
25 assert_equal EvFilt::READ, events[0][1]
28 # we should be drained
30 n = kq.kevent(nil, 1, 0) do |ident,filter,flags,fflags,data,udata|
31 events << [ ident,filter,flags,fflags,data,udata ]
33 assert_equal 0, events.size
38 ev = Kevent[wr.fileno, EvFilt::WRITE, Ev::ADD|Ev::ONESHOT, 0, 0, wr]
40 n = kq.kevent(nil, 1, 0) do |ident,filter,flags,fflags,data,udata|
41 events << [ ident,filter,flags,fflags,data,udata ]
43 assert_equal 1, events.size
44 assert_equal wr.fileno, events[0][0]
45 assert_equal EvFilt::WRITE, events[0][1]
52 end if defined?(SleepyPenguin::Kqueue::IO)