user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
a37964912c20bf5944b5e7631c427dbdc8fe85be blob 1337 bytes (raw)

 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
31
32
33
 
#!perl -w
# Copyright (C) 2020-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;
use Cwd qw(abs_path);
test_lei(sub {
	my $md = "$ENV{HOME}/md";
	for ($md, "$md/new", "$md/cur", "$md/tmp") {
		mkdir($_) or BAIL_OUT("mkdir $_: $!");
	}
	symlink(abs_path('t/data/0001.patch'), "$md/cur/x:2,S") or
		BAIL_OUT "symlink $md $!";
	lei_ok(qw(import), $md, \'import Maildir');
	lei_ok(qw(q s:boolean));
	my $res = json_utf8->decode($lei_out);
	like($res->[0]->{'s'}, qr/use boolean/, 'got expected result');
	is_deeply($res->[0]->{kw}, ['seen'], 'keyword set');
	is($res->[1], undef, 'only got one result');

	lei_ok(qw(import), $md, \'import Maildir again');
	lei_ok(qw(q -d none s:boolean), \'lei q w/o dedupe');
	my $r2 = json_utf8->decode($lei_out);
	is_deeply($r2, $res, 'idempotent import');

	rename("$md/cur/x:2,S", "$md/cur/x:2,SR") or BAIL_OUT "rename: $!";
	lei_ok('import', "maildir:$md", \'import Maildir after +answered');
	lei_ok(qw(q -d none s:boolean), \'lei q after +answered');
	$res = json_utf8->decode($lei_out);
	like($res->[0]->{'s'}, qr/use boolean/, 'got expected result');
	is_deeply($res->[0]->{kw}, ['answered', 'seen'], 'keywords set');
	is($res->[1], undef, 'only got one result');
});
done_testing;
debug log:

solving a3796491 ...
found a3796491 in public-inbox.git

Code repositories for project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).