use PublicInbox::TestCommon;
use PublicInbox::Config;
use PublicInbox::Spawn qw(which);
-require_mods(qw(DBD::SQLite Mail::IMAPClient Mail::IMAPClient::BodyStructure));
+require_mods(qw(DBD::SQLite Mail::IMAPClient Mail::IMAPClient::BodyStructure
+ Email::Address::XS||Mail::Address));
my $imap_client = 'Mail::IMAPClient';
my $can_compress = $imap_client->can('compress');
if ($can_compress) { # hope this gets fixed upstream, soon
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');
+ {
+ my @w; # Mail::IMAPClient hits a warning via overload
+ local $SIG{__WARN__} = sub { push @w, @_ };
+ $ret = $mic->fetch_hash(my $r = '559:558', 'UID');
is_deeply($ret, {}, "out-of-range UID FETCH $r");
+ @w = grep(!/\boverload\.pm\b/, @w);
+ is_deeply(\@w, [], 'no unexpected warning');
}
+ $ret = $mic->fetch_hash(my $r = '558:559', 'UID');
+ is_deeply($ret, {}, "out-of-range UID FETCH $r");
}
for my $r ('1:*', '1') {
is(lc($bs->bodytype), 'text', '->bodytype');
is(lc($bs->bodyenc), '8bit', '->bodyenc');
}
-
-is_deeply([$mic->has_capability('COMPRESS')], ['DEFLATE'], 'deflate cap');
+ok($mic->has_capability('COMPRESS') ||
+ $mic->has_capability('COMPRESS=DEFLATE'), 'deflate cap');
SKIP: {
skip 'Mail::IMAPClient too old for ->compress', 2 if !$can_compress;
my $c = $imap_client->new(%mic_opt);
my $mb = "$ng.$first_range";
my $uidnext = $mic->uidnext($mb); # we'll fetch BODYSTRUCTURE on this
ok($uidnext, 'got uidnext for later fetch');
- is_deeply([$mic->has_capability('IDLE')], ['IDLE'], "IDLE capa $name");
+ ok($mic->has_capability('IDLE'), "IDLE capa $name");
ok(!$mic->idle, "IDLE fails w/o SELECT/EXAMINE $name");
ok($mic->examine($mb), "EXAMINE $ng succeeds");
ok(my $idle_tag = $mic->idle, "IDLE succeeds on $ng");
is($x, $ret->{2}->{RFC822}, 'message 2 unchanged');
}
+# FIXME? no EXPUNGE response, yet
my $r2 = $mic->fetch_hash('1:*', 'BODY.PEEK[]') or BAIL_OUT "FETCH $@";
is(scalar keys %$r2, 2, 'did not get all 3 messages');
-is($r2->{1}->{'BODY[]'}, $ret->{2}->{RFC822}, 'message 2 unchanged');
-is($r2->{2}->{'BODY[]'}, $ret->{3}->{RFC822}, 'message 3 unchanged');
+is($r2->{2}->{'BODY[]'}, $ret->{2}->{RFC822}, 'message 2 unchanged');
+is($r2->{3}->{'BODY[]'}, $ret->{3}->{RFC822}, 'message 3 unchanged');
$r2 = $mic->fetch_hash(2, 'BODY.PEEK[HEADER.FIELDS (message-id)]')
or BAIL_OUT "FETCH $@";
is($r2->{2}->{'BODY[HEADER.FIELDS (MESSAGE-ID)]'},