diff options
author | Eric Wong <e@yhbt.net> | 2020-06-10 07:04:35 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-13 07:55:45 +0000 |
commit | daa98292c95a403975fb4906088c160758b15106 (patch) | |
tree | 8e31c89efd350b23b03070f87751c902b31dc403 /t | |
parent | 94245dfc85576b5981b23fc5c917189b5fbbe3e8 (diff) | |
download | public-inbox-daa98292c95a403975fb4906088c160758b15106.tar.gz |
"$UID_START:*" needs to return at least one message according to RFC 3501 section 6.4.8. While we're in the area, coerce ranges to (unsigned) integers by adding zero ("+ 0") to reduce memory overhead.
Diffstat (limited to 't')
-rw-r--r-- | t/imapd.t | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -116,6 +116,19 @@ $ret = $mic->search('uid 1:*') or BAIL_OUT "SEARCH FAIL $@"; is_deeply($ret, [ 1 ], 'search UID 1:* works'); is_deeply(scalar $mic->flags('1'), [], '->flags works'); +{ + # RFC 3501 section 6.4.8 states: + # Also note that a UID range of 559:* always includes the + # UID of the last message in the mailbox, even if 559 is + # higher than any assigned UID value. + my $exp = $mic->fetch_hash(1, 'UID'); + $ret = $mic->fetch_hash('559:*', 'UID'); + is_deeply($ret, $exp, 'beginning range too big'); + for my $r (qw(559:558 558:559)) { + $ret = $mic->fetch_hash($r, 'UID'); + is_deeply($ret, {}, "out-of-range UID FETCH $r"); + } +} for my $r ('1:*', '1') { $ret = $mic->fetch_hash($r, 'RFC822') or BAIL_OUT "FETCH $@"; |