ruby-changes:20067
From: shugo <ko1@a...>
Date: Thu, 16 Jun 2011 11:41:16 +0900 (JST)
Subject: [ruby-changes:20067] shugo:r32114 (trunk): * lib/net/imap.rb (search_response): parses SEARCH responses from
shugo 2011-06-16 11:41:03 +0900 (Thu, 16 Jun 2011) New Revision: 32114 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32114 Log: * lib/net/imap.rb (search_response): parses SEARCH responses from the Yahoo IMAP server correctly. patched by Mark Nadig. [Bug #4509] Modified files: trunk/ChangeLog trunk/lib/net/imap.rb trunk/test/net/imap/test_imap_response_parser.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 32113) +++ ChangeLog (revision 32114) @@ -1,3 +1,8 @@ +Thu Jun 16 11:35:09 2011 Shugo Maeda <shugo@r...> + + * lib/net/imap.rb (search_response): parses SEARCH responses from + the Yahoo IMAP server correctly. patched by Mark Nadig. [Bug #4509] + Thu Jun 16 09:12:38 2011 Nobuyoshi Nakada <nobu@r...> * fix for build on solaris 10. Index: lib/net/imap.rb =================================================================== --- lib/net/imap.rb (revision 32113) +++ lib/net/imap.rb (revision 32114) @@ -2748,8 +2748,9 @@ break when T_SPACE shift_token + else + data.push(number) end - data.push(number) end else data = [] Index: test/net/imap/test_imap_response_parser.rb =================================================================== --- test/net/imap/test_imap_response_parser.rb (revision 32113) +++ test/net/imap/test_imap_response_parser.rb (revision 32114) @@ -64,7 +64,6 @@ assert_equal [:Inbox], response.data.attr end - def test_resp_text_code parser = Net::IMAP::ResponseParser.new response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint) @@ -72,4 +71,32 @@ EOF assert_equal "CLOSED", response.data.code.name end + + def test_search_response + parser = Net::IMAP::ResponseParser.new + response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint) +* SEARCH +EOF + assert_equal [], response.data + response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint) +* SEARCH 1 +EOF + assert_equal [1], response.data + response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint) +* SEARCH 1 2 3 +EOF + assert_equal [1, 2, 3], response.data + end + + def test_search_response_of_yahoo + parser = Net::IMAP::ResponseParser.new + response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint) +* SEARCH 1 +EOF + assert_equal [1], response.data + response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint) +* SEARCH 1 2 3 +EOF + assert_equal [1, 2, 3], response.data + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/