]> Sergey Matveev's repositories - public-inbox.git/blob - t/lei-lcat.t
t/lei*: set EDITOR for dumb terminals
[public-inbox.git] / t / lei-lcat.t
1 #!perl -w
2 # Copyright (C) 2021 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 use strict; use v5.10.1; use PublicInbox::TestCommon;
5 require_mods(qw(lei));
6
7 test_lei(sub {
8         my $in = "\nMessage-id: <qp\@example.com>\n";
9         lei_ok([qw(lcat --stdin)], undef, { 0 => \$in, %$lei_opt });
10         unlike($lei_out, qr/\S/, 'nothing, yet');
11         lei_ok('import', 't/plack-qp.eml');
12         lei_ok([qw(lcat --stdin)], undef, { 0 => \$in, %$lei_opt });
13         like($lei_out, qr/qp\@example\.com/, 'got a result');
14
15         # test Link:, -f reply, and implicit --stdin:
16         my $prev = $lei_out;
17         $in = "\nLink: https://example.com/foo/qp\@example.com/\n";
18         lei_ok([qw(lcat -f reply)], undef, { 0 => \$in, %$lei_opt});
19         my $exp = <<'EOM';
20 To: qp@example.com
21 Subject: Re: QP
22 In-Reply-To: <qp@example.com>
23
24 On some unknown date, qp wrote:
25 > hi = bye
26 EOM
27         like($lei_out, qr/\AFrom [^\n]+\n\Q$exp\E/sm, '-f reply works');
28 });
29
30 done_testing;