Sha256: ab134b80eef1b0543004f855846d1b747ce27dc607776cfbe6b9fb066a68e48e

Contents?: true

Size: 746 Bytes

Versions: 1

Compression:

Stored size: 746 Bytes

Contents

require 'test/unit'
require 'fcntl'
require 'socket'
require 'thread'
$-w = true
Thread.abort_on_exception = true
require 'sleepy_penguin'

class TestEpollIO < Test::Unit::TestCase
  include SleepyPenguin

  def setup
    @rd, @wr = IO.pipe
    @epio = Epoll::IO.new(nil)
  end

  def test_add_wait
    @epio.epoll_ctl(Epoll::CTL_ADD, @wr, Epoll::OUT)
    ev = []
    @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)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sleepy_penguin-3.2.0 test/test_epoll_io.rb