ruby-changes:21961
From: shugo <ko1@a...>
Date: Sun, 11 Dec 2011 12:21:54 +0900 (JST)
Subject: [ruby-changes:21961] shugo:r34010 (trunk): * lib/net/imap.rb: includes the sequence number of UID in a error
shugo 2011-12-11 12:21:43 +0900 (Sun, 11 Dec 2011) New Revision: 34010 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34010 Log: * lib/net/imap.rb: includes the sequence number of UID in a error message. suggested by art lussos. [ruby-core:41413] [Feature #5692] Modified files: trunk/ChangeLog trunk/lib/net/imap.rb trunk/test/net/imap/test_imap_response_parser.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 34009) +++ ChangeLog (revision 34010) @@ -1,3 +1,9 @@ +Sun Dec 11 12:19:17 2011 Shugo Maeda <shugo@r...> + + * lib/net/imap.rb: includes the sequence number of UID in a error + message. suggested by art lussos. + [ruby-core:41413] [Feature #5692] + Sun Dec 11 11:42:10 2011 Kazuki Tsujimoto <kazuki@c...> * ext/syslog/syslog.c: fix a typo. [ruby-core:41585] [Bug #5740] Index: lib/net/imap.rb =================================================================== --- lib/net/imap.rb (revision 34009) +++ lib/net/imap.rb (revision 34010) @@ -2180,12 +2180,12 @@ when "FETCH" shift_token match(T_SPACE) - data = FetchData.new(n, msg_att) + data = FetchData.new(n, msg_att(n)) return UntaggedResponse.new(name, data, @str) end end - def msg_att + def msg_att(n) match(T_LPAR) attr = {} while true @@ -2214,7 +2214,7 @@ when /\A(?:UID)\z/ni name, val = uid_data else - parse_error("unknown attribute `%s'", token.value) + parse_error("unknown attribute `%s' for {%d}", token.value, n) end attr[name] = val end Index: test/net/imap/test_imap_response_parser.rb =================================================================== --- test/net/imap/test_imap_response_parser.rb (revision 34009) +++ test/net/imap/test_imap_response_parser.rb (revision 34010) @@ -116,4 +116,14 @@ * 1 FETCH (UID 92285 ) EOF end + + def test_msg_att_parse_error + parser = Net::IMAP::ResponseParser.new + e = assert_raise(Net::IMAP::ResponseParseError) { + response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint) +* 123 FETCH (UNKNOWN 92285) +EOF + } + assert_match(/ for \{123\}/, e.message) + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/