2 # Copyright (C) 2020-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;
7 ok($lei->(qw(q s:boolean)), 'search miss before import');
8 unlike($lei_out, qr/boolean/i, 'no results, yet');
9 open my $fh, '<', 't/data/0001.patch' or BAIL_OUT $!;
10 ok($lei->([qw(import -f eml -)], undef, { %$lei_opt, 0 => $fh }),
11 'import single file from stdin');
13 ok($lei->(qw(q s:boolean)), 'search hit after import');
14 ok($lei->(qw(import -f eml), 't/data/message_embed.eml'),
15 'import single file by path');
22 my $opt = { %$lei_opt, 0 => \$str };
23 ok($lei->([qw(import -f eml -)], undef, $opt),
24 'import single file with keywords from stdin');
26 my $res = json_utf8->decode($lei_out);
27 is($res->[1], undef, 'only one result');
28 is_deeply($res->[0]->{kw}, ['seen'], "message `seen' keyword set");
30 $str =~ tr/x/v/; # v@y
31 ok($lei->([qw(import --no-kw -f eml -)], undef, $opt),
32 'import single file with --no-kw from stdin');
34 $res = json_utf8->decode($lei_out);
35 is($res->[1], undef, 'only one result');
36 is_deeply($res->[0]->{kw}, [], 'no keywords set');