public-inbox.git  about / heads / tags
an "archives first" approach to mailing lists
blob 31a84744d5b00d694ea104c8ad9085b65206b6ec 947 bytes (raw)
$ git show HEAD:t/lei-lcat.t	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
#!perl -w
# Copyright (C) 2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict; use v5.10.1; use PublicInbox::TestCommon;
require_mods(qw(lei));

test_lei(sub {
	my $in = "\nMessage-id: <qp\@example.com>\n";
	lei_ok([qw(lcat --stdin)], undef, { 0 => \$in, %$lei_opt });
	unlike($lei_out, qr/\S/, 'nothing, yet');
	lei_ok('import', 't/plack-qp.eml');
	lei_ok([qw(lcat --stdin)], undef, { 0 => \$in, %$lei_opt });
	like($lei_out, qr/qp\@example\.com/, 'got a result');

	# test Link:, -f reply, and implicit --stdin:
	my $prev = $lei_out;
	$in = "\nLink: https://example.com/foo/qp\@example.com/\n";
	lei_ok([qw(lcat -f reply)], undef, { 0 => \$in, %$lei_opt});
	my $exp = <<'EOM';
To: qp@example.com
Subject: Re: QP
In-Reply-To: <qp@example.com>

On some unknown date, qp wrote:
> hi = bye
EOM
	like($lei_out, qr/\AFrom [^\n]+\n\Q$exp\E/sm, '-f reply works');
});

done_testing;

git clone https://public-inbox.org/public-inbox.git
git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git