diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-23 12:18:20 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-23 12:18:20 +0000 |
commit | a8e4a2aa175b0650c0793c2fa64d574b5e8f188e (patch) | |
tree | c0c797888582b2aba919cd5f8b0275a92ad40efc /test | |
parent | e2dc055b2b6ac9d969ffd429781784d7a951eee5 (diff) |
merges r27690 and r27903 from trunk into ruby_1_9_2.
--
* lib/net/imap.rb (disconnect): terminates @receiver_thread even if
@sock.shutdown raises an exception. [ruby-dev:34881]
--
* lib/net/imap.rb (disconnect): closes the socket of a Net::IMAP
object only when it is not closed. [ruby-dev:41350]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@27971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 766131428c..15528b2962 100644 --- a/test/net/imap/test_imap.rb +++ b/test/net/imap/test_imap.rb @@ -315,6 +315,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 |