test_lei({ tmpdir => $tmpdir }, sub {
my $url = "imap://$host_port/t.v2.0";
my $url_orig = $url;
+ lei_ok(qw(ls-mail-source), "imap://$host_port/");
+ like($lei_out, qr/^t\.v2\.0$/ms, 'shows mailbox');
+ lei_ok(qw(ls-mail-source), $url);
+ is($lei_out, "t.v2.0\n", 'shows only mailbox with filter');
+ lei_ok(qw(ls-mail-source -l), "imap://$host_port/");
+ is(ref(json_utf8->decode($lei_out)), 'ARRAY', 'ls-mail-source JSON');
lei_ok(qw(q z:1..));
my $out = json_utf8->decode($lei_out);
$url = $u;
$u =~ s/;UIDVALIDITY=(\d+)\s*/;UIDVALIDITY=9$1/s;
ok(!lei('import', $u), 'UIDVALIDITY mismatch in URL rejected');
+ like($lei_err, qr/UIDVALIDITY mismatch/, 'mismatch noted');
lei_ok('inspect', $url);
my $inspect = json_utf8->decode($lei_out);
is(scalar(@$out), 2, 'got JSON') or diag explain($out);
lei_ok qw(lcat), $url_orig;
is($lei_out, $orig, 'lcat w/o UID works');
+
+ ok(!lei(qw(export-kw), $url_orig), 'export-kw fails on read-only IMAP');
+ like($lei_err, qr/does not support/, 'error noted in failure');
});
done_testing;