diff options
Diffstat (limited to 't/lei-tag.t')
-rw-r--r-- | t/lei-tag.t | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/t/lei-tag.t b/t/lei-tag.t index 44e4659f..7278dfcd 100644 --- a/t/lei-tag.t +++ b/t/lei-tag.t @@ -1,9 +1,10 @@ #!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; +use v5.12; use PublicInbox::TestCommon; require_git 2.6; -require_mods(qw(json DBD::SQLite Search::Xapian)); +require_mods(qw(json DBD::SQLite Xapian)); +use PublicInbox::DS qw(now); my ($ro_home, $cfg_path) = setup_public_inboxes; my $check_kw = sub { my ($exp, %opt) = @_; @@ -84,14 +85,37 @@ test_lei(sub { lei_ok(qw(ls-label)); is($lei_out, "nope\nqp\nurgent\n", 'ls-label shows qp'); - lei_ok qw(tag -F eml t/utf8.eml +L:INBOX +L:x); + lei_ok qw(tag -F eml t/utf8.eml +L:inbox +L:x); lei_ok qw(q m:testmessage@example.com); - $check_kw->([qw(answered seen)], L => [qw(INBOX nope urgent x)]); + $check_kw->([qw(answered seen)], L => [qw(inbox nope urgent x)]); lei_ok(qw(ls-label)); - is($lei_out, "INBOX\nnope\nqp\nurgent\nx\n", 'ls-label shows qp'); + is($lei_out, "inbox\nnope\nqp\nurgent\nx\n", 'ls-label shows qp'); + + lei_ok qw(q L:inbox); + is(json_utf8->decode($lei_out)->[0]->{blob}, + $r2->[0]->{blob}, 'label search works'); + + ok(!lei(qw(tag -F eml t/utf8.eml +L:ALLCAPS)), '+L:ALLCAPS fails'); + lei_ok(qw(ls-label)); + is($lei_out, "inbox\nnope\nqp\nurgent\nx\n", 'ls-label unchanged'); if (0) { # TODO label+kw search w/ externals lei_ok(qw(q L:qp), "mid:$mid", '--only', "$ro_home/t2"); } + lei_ok qw(tag +L:nope -F eml t/data/binary.patch); + like $lei_err, qr/\b1 unimported messages/, 'noted unimported' + or diag $lei_err; + + lei_ok qw(tag -F eml --commit-delay=1 t/utf8.eml +L:utf8); + lei_ok 'ls-label'; + unlike($lei_out, qr/\butf8\b/, 'commit-delay delays label'); + my $end = now + 10; + my $n = 1; + diag 'waiting for lei/store commit...'; + do { + tick $n; + $n = 0.1; + } until (!lei('ls-label') || $lei_out =~ /\butf8\b/ || now > $end); + like($lei_out, qr/\butf8\b/, 'commit-delay eventually commits'); }); done_testing; |