ruby-changes:36299
From: akr <ko1@a...>
Date: Tue, 11 Nov 2014 22:33:56 +0900 (JST)
Subject: [ruby-changes:36299] akr:r48380 (trunk): * test/net/pop/test_pop.rb: Use assert_join_threads.
akr 2014-11-11 22:33:46 +0900 (Tue, 11 Nov 2014) New Revision: 48380 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48380 Log: * test/net/pop/test_pop.rb: Use assert_join_threads. Modified files: trunk/ChangeLog trunk/test/net/pop/test_pop.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 48379) +++ ChangeLog (revision 48380) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Nov 11 22:33:08 2014 Tanaka Akira <akr@f...> + + * test/net/pop/test_pop.rb: Use assert_join_threads. + Tue Nov 11 22:07:20 2014 Tanaka Akira <akr@f...> * test/net/http/test_https_proxy.rb: Use assert_join_threads. Index: test/net/pop/test_pop.rb =================================================================== --- test/net/pop/test_pop.rb (revision 48379) +++ test/net/pop/test_pop.rb (revision 48380) @@ -67,7 +67,7 @@ class TestPOP < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/pop/test_pop.rb#L67 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 https://github.com/ruby/ruby/blob/trunk/test/net/pop/test_pop.rb#L75 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/