summaryrefslogtreecommitdiff
path: root/test/net
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-17 06:18:14 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-17 06:18:14 +0000
commitbd6bb6c0b26168833ff9027611a3febc6eeca91b (patch)
treee5833d59c5b0ffdbe5f8ba2dc078d2146609a941 /test/net
parentc4e63346d241af300594804cb54351817c496a4d (diff)
* lib/net/imap.rb: fix Net::IMAP::ResponseParser to accept
message/delivery-status ([ruby-core:47920] [Bug #7146]), message/rfc822 attachments ([ruby-core:47921] [Bug #7147]), and (BODY ("MIXED")) ([ruby-core:47951] [Bug #7153]). * test/net/imap/test_imap_response_parser.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net')
-rw-r--r--test/net/imap/test_imap_response_parser.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/net/imap/test_imap_response_parser.rb b/test/net/imap/test_imap_response_parser.rb
index 0231ed4..004d936 100644
--- a/test/net/imap/test_imap_response_parser.rb
+++ b/test/net/imap/test_imap_response_parser.rb
@@ -152,4 +152,32 @@ EOF
assert_equal("Fw_ ____ _____ ____.eml",
response.data.attr["BODYSTRUCTURE"].parts[1].body.param["FILENAME"])
end
+
+ def assert_parseable(s)
+ parser = Net::IMAP::ResponseParser.new
+ parser.parse(s.gsub(/\n/, "\r\n").taint)
+ end
+
+ # [Bug #7146]
+ def test_msg_delivery_status
+ # This was part of a larger response that caused crashes, but this was the
+ # minimal test case to demonstrate it
+ assert_parseable <<EOF
+* 4902 FETCH (BODY (("MESSAGE" "DELIVERY-STATUS" NIL NIL NIL "7BIT" 324) "REPORT"))
+EOF
+ end
+
+ # [Bug #7147]
+ def test_msg_with_message_rfc822_attachment
+ assert_parseable <<EOF
+* 5441 FETCH (BODY ((("TEXT" "PLAIN" ("CHARSET" "iso-8859-1") NIL NIL "QUOTED-PRINTABLE" 69 1)("TEXT" "HTML" ("CHARSET" "iso-8859-1") NIL NIL "QUOTED-PRINTABLE" 455 12) "ALTERNATIVE")("MESSAGE" "RFC822" ("NAME" "ATT00026.eml") NIL NIL "7BIT" 4079755) "MIXED"))
+EOF
+ end
+
+ # [Bug #7153]
+ def test_msg_body_mixed
+ assert_parseable <<EOF
+* 1038 FETCH (BODY ("MIXED"))
+EOF
+ end
end