diff options
author | Eric Wong <e@80x24.org> | 2021-04-24 09:28:46 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-04-24 16:10:03 -0400 |
commit | b6b86cfd238c170ea3e2c4d4179f06c7af139086 (patch) | |
tree | bfca234b1b6a95baeb88e9fabb8fd9d90a5f6d8a /t/lei-import-maildir.t | |
parent | 7dd4d590e1d5e12b2b767122aeec66124a10acb1 (diff) | |
download | public-inbox-b6b86cfd238c170ea3e2c4d4179f06c7af139086.tar.gz |
We aren't using it, yet, but the plan is to be able to use this information to propagate keyword changes back to IMAP and Maildir folders using some to-be-implemented command. "lei inspect" is a half-baked new command to make testing this change easier. It will be updated to support more SQLite+Xapian introspection duties in the future, including public-inbox things independent of lei.
Diffstat (limited to 't/lei-import-maildir.t')
-rw-r--r-- | t/lei-import-maildir.t | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/t/lei-import-maildir.t b/t/lei-import-maildir.t index 6706b014..3e3d9188 100644 --- a/t/lei-import-maildir.t +++ b/t/lei-import-maildir.t @@ -12,6 +12,21 @@ test_lei(sub { BAIL_OUT "symlink $md $!"; lei_ok(qw(import), $md, \'import Maildir'); my $imp_err = $lei_err; + + my %i; + lei_ok('inspect', $md); $i{no_type} = $lei_out; + lei_ok('inspect', "maildir:$md"), $i{with_type} = $lei_out; + lei_ok(['inspect', $md], undef, { -C => $ENV{HOME}, %$lei_opt }); + $i{rel_no_type} = $lei_out; + lei_ok(['inspect', "maildir:$md"], undef, + { -C => $ENV{HOME}, %$lei_opt }); + $i{rel_with_type} = $lei_out; + my %v = map { $_ => 1 } values %i; + is(scalar(keys %v), 1, 'inspect handles relative and absolute paths'); + my $inspect = json_utf8->decode([ keys %v ]->[0]); + is_deeply($inspect, {"maildir:$md" => { 'name.count' => 1 }}, + 'inspect maildir: path had expected output'); + lei_ok(qw(q s:boolean)); my $res = json_utf8->decode($lei_out); like($res->[0]->{'s'}, qr/use boolean/, 'got expected result') @@ -19,6 +34,12 @@ test_lei(sub { is_deeply($res->[0]->{kw}, ['seen'], 'keyword set'); is($res->[1], undef, 'only got one result'); + lei_ok('inspect', "blob:$res->[0]->{blob}"); + $inspect = json_utf8->decode($lei_out); + is(ref(delete $inspect->{"lei/store"}), 'ARRAY', 'lei/store IDs'); + is_deeply($inspect, { sync => { "maildir:$md" => [ 'x:2,S' ] } }, + 'maildir sync info as expected'); + lei_ok(qw(import), $md, \'import Maildir again'); $imp_err = $lei_err; lei_ok(qw(q -d none s:boolean), \'lei q w/o dedupe'); |