From e48c8be89b6324d817e46e3feadfc207226d93a6 Mon Sep 17 00:00:00 2001 From: shugo Date: Sun, 11 Dec 2011 03:21:43 +0000 Subject: [PATCH] * lib/net/imap.rb: includes the sequence number of UID in a error message. suggested by art lussos. [ruby-core:41413] [Feature #5692] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ lib/net/imap.rb | 6 +++--- test/net/imap/test_imap_response_parser.rb | 10 ++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bbb0b7f787..8137c3b3bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Dec 11 12:19:17 2011 Shugo Maeda + + * 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 * ext/syslog/syslog.c: fix a typo. [ruby-core:41585] [Bug #5740] diff --git a/lib/net/imap.rb b/lib/net/imap.rb index a683ea388b..c8faf97c11 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -2180,12 +2180,12 @@ module Net 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 @@ module Net 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 diff --git a/test/net/imap/test_imap_response_parser.rb b/test/net/imap/test_imap_response_parser.rb index 6a5a117408..3f26e0b350 100644 --- a/test/net/imap/test_imap_response_parser.rb +++ b/test/net/imap/test_imap_response_parser.rb @@ -116,4 +116,14 @@ EOF * 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(<