about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-04-13 10:54:46 +0000
committerEric Wong <e@80x24.org>2021-04-13 15:06:09 -0400
commit3052acd27f3119510b3efa33d77b610d6c4f1c85 (patch)
tree0e57051122af65f0802074b83c8752c87020f925 /t
parent8ab43c1c27c725a8ef9307f5dba3e565169d48ca (diff)
downloadpublic-inbox-3052acd27f3119510b3efa33d77b610d6c4f1c85.tar.gz
The command isn't finalized, yet, but it's intended to update
an existing saved search.
Diffstat (limited to 't')
-rw-r--r--t/lei-q-save.t17
1 files changed, 15 insertions, 2 deletions
diff --git a/t/lei-q-save.t b/t/lei-q-save.t
index 56f7cb37..a6d579cf 100644
--- a/t/lei-q-save.t
+++ b/t/lei-q-save.t
@@ -2,11 +2,24 @@
 # 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;
+my $doc1 = eml_load('t/plack-qp.eml');
+my $doc2 = eml_load('t/utf8.eml');
 test_lei(sub {
         my $home = $ENV{HOME};
-        lei_ok qw(import t/plack-qp.eml);
-        lei_ok qw(q --save z:0..), '-o', "$home/md/";
+        lei_ok qw(import -q t/plack-qp.eml);
+        lei_ok qw(q -q --save z:0..), '-o', "$home/md/";
+        my %before = map { $_ => 1 } glob("$home/md/cur/*");
+        is_deeply(eml_load((keys %before)[0]), $doc1, 'doc1 matches');
+
         my @s = glob("$home/.local/share/lei/saved-searches/md-*");
         is(scalar(@s), 1, 'got one saved search');
+
+        # ensure "lei up" works, since it compliments "lei q --save"
+        lei_ok qw(import t/utf8.eml);
+        lei_ok qw(up), $s[0];
+        my %after = map { $_ => 1 } glob("$home/md/cur/*");
+        is(delete $after{(keys(%before))[0]}, 1, 'original message kept');
+        is(scalar(keys %after), 1, 'one new message added');
+        is_deeply(eml_load((keys %after)[0]), $doc2, 'doc2 matches');
 });
 done_testing;