3 Thread.abort_on_exception = true
4 require 'sleepy_penguin'
6 class TestKqueue < Test::Unit::TestCase
11 assert_kind_of IO, kq.to_io
13 ev = Kevent[rd.fileno, EvFilt::READ, Ev::ADD|Ev::ONESHOT, 0, 0, rd]
20 n = kq.kevent(nil, 1) do |kevent|
21 assert_kind_of Kevent, kevent
24 assert_equal 1, events.size
25 assert_equal rd.fileno, events[0][0]
26 assert_equal EvFilt::READ, events[0][1]
29 # we should be drained
31 n = kq.kevent(nil, 1, 0) do |kevent|
32 assert_kind_of Kevent, kevent
35 assert_equal 0, events.size
40 ev = Kevent[wr.fileno, EvFilt::WRITE, Ev::ADD|Ev::ONESHOT, 0, 0, wr]
42 n = kq.kevent(nil, 1, 0) do |kevent|
43 assert_kind_of Kevent, kevent
46 assert_equal 1, events.size
47 assert_equal wr.fileno, events[0][0]
48 assert_equal EvFilt::WRITE, events[0][1]
55 end if defined?(SleepyPenguin::Kqueue)