diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-08 23:25:54 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-08 23:25:54 +0000 |
commit | e240f93f2174d80040d381ef889fcefb48e8378e (patch) | |
tree | d551e73633e74f1aa9f8de62cfa9ba3756789be5 /test/net/imap | |
parent | 81f4dba3850f108dbd1c9aad5f175a8e9fbfe5f4 (diff) | |
download | ruby-e240f93f2174d80040d381ef889fcefb48e8378e.tar.gz |
* lib/net/imap.rb (disconnect): terminates @receiver_thread even if
@sock.shutdown raises an exception. [ruby-dev:34881]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/imap')
-rw-r--r-- | test/net/imap/test_imap.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb index 501298cdc4..0ecd3e8de5 100644 --- a/test/net/imap/test_imap.rb +++ b/test/net/imap/test_imap.rb @@ -311,6 +311,43 @@ class IMAPTest < Test::Unit::TestCase end end + def test_exception_during_shutdown + server = TCPServer.new(0) + port = server.addr[1] + Thread.start do + begin + 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 + end + rescue + end + end + begin + begin + imap = Net::IMAP.new("localhost", :port => port) + imap.instance_eval do + def @sock.shutdown(*args) + super + raise "error" + end + end + imap.logout + ensure + assert_raise(RuntimeError) do + imap.disconnect + end + end + ensure + server.close + end + end + private def imaps_test |