summaryrefslogtreecommitdiffstats
path: root/test/T060-count.sh
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-08-24 08:17:43 -0700
committerDavid Bremner <david@tethera.net>2021-09-04 17:07:19 -0700
commit2944d5913319056dfec5c23065932fd1c87a96f6 (patch)
treeb4f7711a7ee1cbb46f54dd2a4a711ebff2bb5472 /test/T060-count.sh
parenta2e7af5b6986bca5a2bb2752f892cb86a9767b3c (diff)
CLI/{count, dump, reindex, reply, show}: enable sexp queries
The change in each case is to call notmuch_query_create_with_syntax, relying on the already inherited shared options. As a bonus we get improved error handling from the new query creation API. The remaining subcommand is 'tag', which is a bit trickier.
Diffstat (limited to 'test/T060-count.sh')
-rwxr-xr-xtest/T060-count.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/T060-count.sh b/test/T060-count.sh
index a1ebf8ba..6ad80df9 100755
--- a/test/T060-count.sh
+++ b/test/T060-count.sh
@@ -154,4 +154,28 @@ print("4: {} messages".format(query.count_messages()))
EOF
test_expect_equal_file EXPECTED OUTPUT
+if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
+
+ test_begin_subtest "and of exact terms (query=sexp)"
+ output=$(notmuch count --query=sexp '(and "wonderful" "wizard")')
+ test_expect_equal "$output" 1
+
+ test_begin_subtest "or of exact terms (query=sexp)"
+ output=$(notmuch count --query=sexp '(or "php" "wizard")')
+ test_expect_equal "$output" 2
+
+ test_begin_subtest "starts-with, case-insensitive (query=sexp)"
+ output=$(notmuch count --query=sexp '(starts-with FreeB)')
+ test_expect_equal "$output" 5
+
+ test_begin_subtest "query that matches no messages (query=sexp)"
+ count=$(notmuch count --query=sexp '(and (from keithp) (to keithp))')
+ test_expect_equal 0 "$count"
+
+ test_begin_subtest "Compound subquery (query=sexp)"
+ output=$(notmuch count --query=sexp '(thread (of (from keithp) (subject Maildir)))')
+ test_expect_equal "$output" 7
+
+fi
+
test_done