mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
* test/net/pop/test_pop.rb: Use assert_join_threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7bb546a2a1
commit
1fca7620dc
2 changed files with 20 additions and 12 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Tue Nov 11 22:33:08 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* test/net/pop/test_pop.rb: Use assert_join_threads.
|
||||||
|
|
||||||
Tue Nov 11 22:07:20 2014 Tanaka Akira <akr@fsij.org>
|
Tue Nov 11 22:07:20 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* test/net/http/test_https_proxy.rb: Use assert_join_threads.
|
* test/net/http/test_https_proxy.rb: Use assert_join_threads.
|
||||||
|
|
|
@ -67,7 +67,7 @@ class TestPOP < Test::Unit::TestCase
|
||||||
host = 'localhost'
|
host = 'localhost'
|
||||||
server = TCPServer.new(host, 0)
|
server = TCPServer.new(host, 0)
|
||||||
port = server.addr[1]
|
port = server.addr[1]
|
||||||
thread = Thread.start do
|
server_thread = Thread.start do
|
||||||
sock = server.accept
|
sock = server.accept
|
||||||
begin
|
begin
|
||||||
pop_server_loop(sock, apop)
|
pop_server_loop(sock, apop)
|
||||||
|
@ -75,20 +75,24 @@ class TestPOP < Test::Unit::TestCase
|
||||||
sock.close
|
sock.close
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
begin
|
client_thread = Thread.start do
|
||||||
pop = Net::POP3::APOP(apop).new(host, port)
|
|
||||||
#pop.set_debug_output $stderr
|
|
||||||
yield pop
|
|
||||||
ensure
|
|
||||||
begin
|
begin
|
||||||
pop.finish
|
begin
|
||||||
rescue IOError
|
pop = Net::POP3::APOP(apop).new(host, port)
|
||||||
raise unless $!.message == "POP session not yet started"
|
#pop.set_debug_output $stderr
|
||||||
|
yield pop
|
||||||
|
ensure
|
||||||
|
begin
|
||||||
|
pop.finish
|
||||||
|
rescue IOError
|
||||||
|
raise unless $!.message == "POP session not yet started"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ensure
|
||||||
|
server.close
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
ensure
|
assert_join_threads([client_thread, server_thread])
|
||||||
server.close
|
|
||||||
thread.value
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def pop_server_loop(sock, apop)
|
def pop_server_loop(sock, apop)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue