aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-08-14 12:02:59 -0300
committerDavid Bremner <david@tethera.net>2022-09-03 08:43:33 -0300
commit2e5ef69fbf9ce9d67720d5d4abba3026302734e5 (patch)
treeb122d17950f5d228c4616ed819ddeab633867591 /test
parent93c602a82fdbd03e0104ea922d073b2b1aa6b241 (diff)
lib: add field processor for lastmod: prefix
By sharing the existing logic used by the sexp query parser, this allows negative lastmod revisions to be interpreted as relative to the most recent revision.
Diffstat (limited to 'test')
-rwxr-xr-xtest/T570-revision-tracking.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/T570-revision-tracking.sh b/test/T570-revision-tracking.sh
index aaa45468..a7480050 100755
--- a/test/T570-revision-tracking.sh
+++ b/test/T570-revision-tracking.sh
@@ -103,4 +103,23 @@ if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
test_expect_equal 1 "$count"
fi
+test_begin_subtest 'exclude one message using negative lastmod'
+total=$(notmuch count '*')
+notmuch tag +${RANDOM} id:4EFC743A.3060609@april.org
+count=$(notmuch count lastmod:-1..)
+test_expect_equal 1 "$count"
+
+test_begin_subtest 'exclude one message using negative lastmod (second param)'
+total=$(notmuch count '*')
+notmuch tag +${RANDOM} id:4EFC743A.3060609@april.org
+count=$(notmuch count lastmod:..-1)
+test_expect_equal 51 "$count"
+
+test_begin_subtest 'negative lastmod (two parameters)'
+notmuch tag +${RANDOM} '*'
+before=$(notmuch count --lastmod '*' | cut -f3)
+notmuch tag +${RANDOM} id:4EFC743A.3060609@april.org
+count=$(notmuch count lastmod:-100..$before)
+test_expect_equal 51 "$count"
+
test_done