* 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
This commit is contained in:
shugo 2011-12-11 03:21:43 +00:00
parent 9952139011
commit e48c8be89b
3 changed files with 19 additions and 3 deletions

View File

@ -1,3 +1,9 @@
Sun Dec 11 12:19:17 2011 Shugo Maeda <shugo@ruby-lang.org>
* 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@callcc.net> Sun Dec 11 11:42:10 2011 Kazuki Tsujimoto <kazuki@callcc.net>
* ext/syslog/syslog.c: fix a typo. [ruby-core:41585] [Bug #5740] * ext/syslog/syslog.c: fix a typo. [ruby-core:41585] [Bug #5740]

View File

@ -2180,12 +2180,12 @@ module Net
when "FETCH" when "FETCH"
shift_token shift_token
match(T_SPACE) match(T_SPACE)
data = FetchData.new(n, msg_att) data = FetchData.new(n, msg_att(n))
return UntaggedResponse.new(name, data, @str) return UntaggedResponse.new(name, data, @str)
end end
end end
def msg_att def msg_att(n)
match(T_LPAR) match(T_LPAR)
attr = {} attr = {}
while true while true
@ -2214,7 +2214,7 @@ module Net
when /\A(?:UID)\z/ni when /\A(?:UID)\z/ni
name, val = uid_data name, val = uid_data
else else
parse_error("unknown attribute `%s'", token.value) parse_error("unknown attribute `%s' for {%d}", token.value, n)
end end
attr[name] = val attr[name] = val
end end

View File

@ -116,4 +116,14 @@ EOF
* 1 FETCH (UID 92285 ) * 1 FETCH (UID 92285 )
EOF EOF
end 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 end