From 9b3cd5e254fafa08c774a24f85c2b2eac12a9de5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 28 May 2021 00:07:56 +0000 Subject: lei: handle a single IMAP message in most places "lei import" can now import a single IMAP message via Likewise, "lei inspect" can show the blob information for UID URLs and "lei lcat" can display the blob without network access if imported. "lei lcat" also gets rid of some unused code and supports "blob:$OIDHEX" syntax as described in the comments (and used by our "text" output format). v2: enforce UID in URL, fail without v3: fix error reporting (s/fail/child_error/) --- t/lei-import-imap.t | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 't') diff --git a/t/lei-import-imap.t b/t/lei-import-imap.t index 5283cc23..59d481d5 100644 --- a/t/lei-import-imap.t +++ b/t/lei-import-imap.t @@ -75,5 +75,20 @@ test_lei({ tmpdir => $tmpdir }, sub { lei_ok 'forget-mail-sync', $url; lei_ok 'ls-mail-sync'; unlike($lei_out, qr!\Q$host_port\E!, 'sync info gone after forget'); + my $uid_url = "$url/;UID=".$stats->{'uid.max'}; + lei_ok 'import', $uid_url; + lei_ok 'inspect', $uid_url; + $lei_out =~ /([a-f0-9]{40,})/ or + xbail 'inspect missed blob with UID URL'; + my $blob = $1; + lei_ok 'lcat', $uid_url; + like $lei_out, qr/^Subject: /sm, + 'lcat shows mail text with UID URL'; + like $lei_out, qr/\bblob:$blob\b/, 'lcat showed blob'; + my $orig = $lei_out; + lei_ok 'lcat', "blob:$blob"; + is($lei_out, $orig, 'lcat understands blob:...'); + ok(!lei('lcat', $url), "lcat doesn't work on IMAP URL w/o UID"); }); + done_testing; -- cgit v1.2.3-24-ge0c7