Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (31 sloc) 0.852 kb
40f1335 @phiggins Test cleanup.
phiggins authored
1 require 'em_test_helper'
6a2aa74 @coderrr getsockopt() support, EM::Connection#get_sock_opt
coderrr authored
2 require 'socket'
3
4 class TestGetSockOpt < Test::Unit::TestCase
5
40f1335 @phiggins Test cleanup.
phiggins authored
6 if EM.respond_to? :get_sock_opt
7 def setup
8 assert(!EM.reactor_running?)
9 end
6a2aa74 @coderrr getsockopt() support, EM::Connection#get_sock_opt
coderrr authored
10
40f1335 @phiggins Test cleanup.
phiggins authored
11 def teardown
12 assert(!EM.reactor_running?)
13 end
14
15 #-------------------------------------
6a2aa74 @coderrr getsockopt() support, EM::Connection#get_sock_opt
coderrr authored
16
40f1335 @phiggins Test cleanup.
phiggins authored
17 def test_get_sock_opt
18 test = self
19 EM.run do
20 EM.connect 'google.com', 80, Module.new {
21 define_method :connection_completed do
22 val = get_sock_opt Socket::SOL_SOCKET, Socket::SO_ERROR
23 test.assert_equal "\0\0\0\0", val
24 EM.stop
25 end
26 }
27 end
28 end
29 else
30 warn "EM.get_sock_opt not implemented, skipping tests in #{__FILE__}"
6a2aa74 @coderrr getsockopt() support, EM::Connection#get_sock_opt
coderrr authored
31
40f1335 @phiggins Test cleanup.
phiggins authored
32 # Because some rubies will complain if a TestCase class has no tests
33 def test_em_get_sock_opt_unsupported
34 assert true
6a2aa74 @coderrr getsockopt() support, EM::Connection#get_sock_opt
coderrr authored
35 end
36 end
37 end
Something went wrong with that request. Please try again.