mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05: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>
|
||||
|
||||
* test/net/http/test_https_proxy.rb: Use assert_join_threads.
|
||||
|
|
|
@ -67,7 +67,7 @@ class TestPOP < Test::Unit::TestCase
|
|||
host = 'localhost'
|
||||
server = TCPServer.new(host, 0)
|
||||
port = server.addr[1]
|
||||
thread = Thread.start do
|
||||
server_thread = Thread.start do
|
||||
sock = server.accept
|
||||
begin
|
||||
pop_server_loop(sock, apop)
|
||||
|
@ -75,20 +75,24 @@ class TestPOP < Test::Unit::TestCase
|
|||
sock.close
|
||||
end
|
||||
end
|
||||
begin
|
||||
pop = Net::POP3::APOP(apop).new(host, port)
|
||||
#pop.set_debug_output $stderr
|
||||
yield pop
|
||||
ensure
|
||||
client_thread = Thread.start do
|
||||
begin
|
||||
pop.finish
|
||||
rescue IOError
|
||||
raise unless $!.message == "POP session not yet started"
|
||||
begin
|
||||
pop = Net::POP3::APOP(apop).new(host, port)
|
||||
#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
|
||||
ensure
|
||||
server.close
|
||||
thread.value
|
||||
assert_join_threads([client_thread, server_thread])
|
||||
end
|
||||
|
||||
def pop_server_loop(sock, apop)
|
||||
|
|
Loading…
Reference in a new issue