eventmachine 1.2.1-x64-mingw32 → 1.2.2-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,7 @@ class TestResolver < Test::Unit::TestCase
20
20
  pend('FIXME: this test is broken on Windows') if windows?
21
21
 
22
22
  EM.run {
23
- d = EM::DNS::Resolver.resolve "google.com"
23
+ d = EM::DNS::Resolver.resolve "example.com"
24
24
  d.errback { assert false }
25
25
  d.callback { |r|
26
26
  assert r
@@ -45,6 +45,7 @@ class TestResolver < Test::Unit::TestCase
45
45
  }
46
46
  end
47
47
 
48
+ # There isn't a public DNS entry like 'example.com' with an A rrset
48
49
  def test_a_pair
49
50
  pend('FIXME: this test is broken on Windows') if windows?
50
51
 
@@ -78,8 +79,8 @@ class TestResolver < Test::Unit::TestCase
78
79
  pend('FIXME: this test is broken on Windows') if windows?
79
80
 
80
81
  EM.run {
81
- d = EM::DNS::Resolver.resolve "google.com"
82
- d.errback { |err| assert false, "failed to resolve google.com: #{err}" }
82
+ d = EM::DNS::Resolver.resolve "example.com"
83
+ d.errback { |err| assert false, "failed to resolve example.com: #{err}" }
83
84
  d.callback { |r|
84
85
  # This isn't a great test, but it's hard to get more canonical
85
86
  # confirmation that the timer is cancelled
@@ -0,0 +1,54 @@
1
+ require 'em_test_helper'
2
+ require 'socket'
3
+
4
+ class TestSockOpt < Test::Unit::TestCase
5
+ def setup
6
+ assert(!EM.reactor_running?)
7
+ @port = next_port
8
+ end
9
+
10
+ def teardown
11
+ assert(!EM.reactor_running?)
12
+ end
13
+
14
+ def test_set_sock_opt
15
+ omit_if(windows?)
16
+ omit_if(!EM.respond_to?(:set_sock_opt))
17
+
18
+ val = nil
19
+ test_module = Module.new do
20
+ define_method :post_init do
21
+ val = set_sock_opt Socket::SOL_SOCKET, Socket::SO_BROADCAST, true
22
+ EM.stop
23
+ end
24
+ end
25
+
26
+ EM.run do
27
+ EM.start_server '127.0.0.1', @port
28
+ EM.connect '127.0.0.1', @port, test_module
29
+ end
30
+
31
+ assert_equal 0, val
32
+ end
33
+
34
+ def test_get_sock_opt
35
+ omit_if(windows?)
36
+ omit_if(!EM.respond_to?(:set_sock_opt))
37
+
38
+ val = nil
39
+ test_module = Module.new do
40
+ define_method :connection_completed do
41
+ val = get_sock_opt Socket::SOL_SOCKET, Socket::SO_ERROR
42
+ EM.stop
43
+ end
44
+ end
45
+
46
+ EM.run do
47
+ EM.start_server '127.0.0.1', @port
48
+ EM.connect '127.0.0.1', @port, test_module
49
+ end
50
+
51
+ assert_equal "\0\0\0\0", val
52
+ end
53
+
54
+ end
@@ -9,19 +9,20 @@ class TestStomp < Test::Unit::TestCase
9
9
  size || str.size
10
10
  end
11
11
 
12
- def test_content_length_in_bytes
13
- connection = Object.new
14
- connection.instance_eval do
15
- extend EM::P::Stomp
12
+ class TStomp
13
+ include EM::P::Stomp
16
14
 
17
- def last_sent_content_length
18
- @sent && Integer(@sent[CONTENT_LENGTH_REGEX, 1])
19
- end
15
+ def last_sent_content_length
16
+ @sent && Integer(@sent[CONTENT_LENGTH_REGEX, 1])
17
+ end
20
18
 
21
- def send_data(string)
22
- @sent = string
23
- end
19
+ def send_data(string)
20
+ @sent = string
24
21
  end
22
+ end
23
+
24
+ def test_content_length_in_bytes
25
+ connection = TStomp.new
25
26
 
26
27
  queue = "queue"
27
28
  failure_message = "header content-length is not the byte size of last sent body"
@@ -1,5 +1,4 @@
1
1
  require 'em_test_helper'
2
- require 'socket'
3
2
 
4
3
  class TestUnbindReason < Test::Unit::TestCase
5
4
 
@@ -11,42 +10,31 @@ class TestUnbindReason < Test::Unit::TestCase
11
10
  end
12
11
  end
13
12
 
13
+ # RFC 5737 Address Blocks Reserved for Documentation
14
14
  def test_connect_timeout
15
- error = nil
16
- EM.run {
17
- conn = EM.connect 'google.com', 81, Module.new{ |m|
18
- m.send(:define_method, :unbind) do |reason|
19
- error = reason
20
- EM.stop
21
- end
22
- }
23
- conn.pending_connect_timeout = TIMEOUT_INTERVAL
24
- }
25
- assert_equal Errno::ETIMEDOUT, error
15
+ conn = nil
16
+ EM.run do
17
+ conn = EM.connect '192.0.2.0', 80, StubConnection
18
+ conn.pending_connect_timeout = 1
19
+ end
20
+ assert_equal Errno::ETIMEDOUT, conn.error
26
21
  end
27
22
 
28
23
  def test_connect_refused
29
24
  pend('FIXME: this test is broken on Windows') if windows?
30
-
31
- error = nil
32
- EM.run {
33
- EM.connect '127.0.0.1', 12388, Module.new{ |m|
34
- m.send(:define_method, :unbind) do |reason|
35
- error = reason
36
- EM.stop
37
- end
38
- }
39
- }
40
- assert_equal Errno::ECONNREFUSED, error
25
+ conn = nil
26
+ EM.run do
27
+ conn = EM.connect '127.0.0.1', 12388, StubConnection
28
+ end
29
+ assert_equal Errno::ECONNREFUSED, conn.error
41
30
  end
42
31
 
43
32
  def test_optional_argument
44
33
  pend('FIXME: this test is broken on Windows') if windows?
45
-
46
34
  conn = nil
47
- EM.run {
35
+ EM.run do
48
36
  conn = EM.connect '127.0.0.1', 12388, StubConnection
49
- }
37
+ end
50
38
  assert_equal Errno::ECONNREFUSED, conn.error
51
39
  end
52
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventmachine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Francis Cianfrocca
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-11-17 00:00:00.000000000 Z
12
+ date: 2017-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
@@ -217,7 +217,6 @@ files:
217
217
  - tests/test_file_watch.rb
218
218
  - tests/test_fork.rb
219
219
  - tests/test_futures.rb
220
- - tests/test_get_sock_opt.rb
221
220
  - tests/test_handler_check.rb
222
221
  - tests/test_hc.rb
223
222
  - tests/test_httpclient.rb
@@ -247,10 +246,10 @@ files:
247
246
  - tests/test_sasl.rb
248
247
  - tests/test_send_file.rb
249
248
  - tests/test_servers.rb
250
- - tests/test_set_sock_opt.rb
251
249
  - tests/test_shutdown_hooks.rb
252
250
  - tests/test_smtpclient.rb
253
251
  - tests/test_smtpserver.rb
252
+ - tests/test_sock_opt.rb
254
253
  - tests/test_spawn.rb
255
254
  - tests/test_ssl_args.rb
256
255
  - tests/test_ssl_dhparam.rb
@@ -331,7 +330,6 @@ test_files:
331
330
  - tests/test_file_watch.rb
332
331
  - tests/test_fork.rb
333
332
  - tests/test_futures.rb
334
- - tests/test_get_sock_opt.rb
335
333
  - tests/test_handler_check.rb
336
334
  - tests/test_hc.rb
337
335
  - tests/test_httpclient.rb
@@ -361,10 +359,10 @@ test_files:
361
359
  - tests/test_sasl.rb
362
360
  - tests/test_send_file.rb
363
361
  - tests/test_servers.rb
364
- - tests/test_set_sock_opt.rb
365
362
  - tests/test_shutdown_hooks.rb
366
363
  - tests/test_smtpclient.rb
367
364
  - tests/test_smtpserver.rb
365
+ - tests/test_sock_opt.rb
368
366
  - tests/test_spawn.rb
369
367
  - tests/test_ssl_args.rb
370
368
  - tests/test_ssl_dhparam.rb
@@ -1,37 +0,0 @@
1
- require 'em_test_helper'
2
- require 'socket'
3
-
4
- class TestGetSockOpt < Test::Unit::TestCase
5
-
6
- if EM.respond_to? :get_sock_opt
7
- def setup
8
- assert(!EM.reactor_running?)
9
- end
10
-
11
- def teardown
12
- assert(!EM.reactor_running?)
13
- end
14
-
15
- #-------------------------------------
16
-
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__}"
31
-
32
- # Because some rubies will complain if a TestCase class has no tests
33
- def test_em_get_sock_opt_unsupported
34
- assert true
35
- end
36
- end
37
- end
@@ -1,39 +0,0 @@
1
- require 'em_test_helper'
2
- require 'socket'
3
-
4
- class TestSetSockOpt < Test::Unit::TestCase
5
-
6
- if EM.respond_to? :set_sock_opt
7
- def setup
8
- assert(!EM.reactor_running?)
9
- end
10
-
11
- def teardown
12
- assert(!EM.reactor_running?)
13
- end
14
-
15
- #-------------------------------------
16
-
17
- def test_set_sock_opt
18
- omit_if(windows?)
19
-
20
- test = self
21
- EM.run do
22
- EM.connect 'google.com', 80, Module.new {
23
- define_method :post_init do
24
- val = set_sock_opt Socket::SOL_SOCKET, Socket::SO_BROADCAST, true
25
- test.assert_equal 0, val
26
- EM.stop
27
- end
28
- }
29
- end
30
- end
31
- else
32
- warn "EM.set_sock_opt not implemented, skipping tests in #{__FILE__}"
33
-
34
- # Because some rubies will complain if a TestCase class has no tests
35
- def test_em_set_sock_opt_unsupported
36
- assert true
37
- end
38
- end
39
- end