summaryrefslogtreecommitdiff
path: root/test/net
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-11 13:33:46 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-11 13:33:46 +0000
commit1fca7620dc13e981a0c74705495124dfcc65d760 (patch)
treefd3a351c8027f8daf9fb81e044f05fab8c0a411c /test/net
parent7bb546a2a1f44182b15285e4e5ef9b766df07f82 (diff)
* 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
Diffstat (limited to 'test/net')
-rw-r--r--test/net/pop/test_pop.rb28
1 files changed, 16 insertions, 12 deletions
diff --git a/test/net/pop/test_pop.rb b/test/net/pop/test_pop.rb
index 94c76ed..7aa65a4 100644
--- a/test/net/pop/test_pop.rb
+++ b/test/net/pop/test_pop.rb
@@ -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)