Sha256: 7e2552922013d563b30dee4aff25644ad19ecb58d38d2b3909377fe770fe8bb8

Contents?: true

Size: 662 Bytes

Versions: 3

Compression:

Stored size: 662 Bytes

Contents

require_relative 'helper'
require 'fcntl'
require 'socket'
require 'thread'

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(: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

3 entries across 3 versions & 1 rubygems

Version Path
sleepy_penguin-3.5.2 test/test_epoll_io.rb
sleepy_penguin-3.5.1 test/test_epoll_io.rb
sleepy_penguin-3.5.0 test/test_epoll_io.rb