summaryrefslogtreecommitdiff
path: root/test/net/imap
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-11 07:56:52 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-11 07:56:52 +0000
commitcea73b2df9e8f8516e53a896944c05795fc35e4d (patch)
tree89a8450917c3fec2014dac54596aef3b42d8bb8c /test/net/imap
parentcb302650a0ebec5ce8a5a949186a6f2e9a875197 (diff)
net/imap: Net::IMAP#disconnect need not do anything if already disconnected
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/imap')
-rw-r--r--test/net/imap/test_imap.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb
index 35e5ed8982..3224da65a1 100644
--- a/test/net/imap/test_imap.rb
+++ b/test/net/imap/test_imap.rb
@@ -526,6 +526,33 @@ class IMAPTest < Test::Unit::TestCase
end
end
+ def test_disconnect
+ server = create_tcp_server
+ port = server.addr[1]
+ @threads << Thread.start do
+ sock = server.accept
+ begin
+ sock.print("* OK test server\r\n")
+ sock.gets
+ sock.print("* BYE terminating connection\r\n")
+ sock.print("RUBY0001 OK LOGOUT completed\r\n")
+ ensure
+ sock.close
+ server.close
+ end
+ end
+ begin
+ imap = Net::IMAP.new(SERVER_ADDR, :port => port)
+ imap.logout
+ imap.disconnect
+ assert_equal(true, imap.disconnected?)
+ imap.disconnect
+ assert_equal(true, imap.disconnected?)
+ ensure
+ imap.disconnect if imap && !imap.disconnected?
+ end
+ end
+
private
def imaps_test