summaryrefslogtreecommitdiffstats
path: root/test/T520-show.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/T520-show.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/T520-show.sh')
-rwxr-xr-xtest/T520-show.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/T520-show.sh b/test/T520-show.sh
index 6f42ca12..12bde6c7 100755
--- a/test/T520-show.sh
+++ b/test/T520-show.sh
@@ -3,6 +3,13 @@ test_description='"notmuch show"'
. $(dirname "$0")/test-lib.sh || exit 1
+test_query_syntax () {
+ test_begin_subtest "sexpr query: $1"
+ sexp=$(notmuch show --format=json --query=sexp "$1")
+ infix=$(notmuch show --format=json "$2")
+ test_expect_equal_json "$sexp" "$infix"
+}
+
add_email_corpus
test_begin_subtest "exit code for show invalid query"
@@ -27,4 +34,15 @@ notmuch show --entire-thread=true --sort=newest-first $QUERY > EXPECTED
notmuch show --entire-thread=true --sort=oldest-first $QUERY > OUTPUT
test_expect_equal_file EXPECTED OUTPUT
+
+if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
+
+ test_query_syntax '(and "wonderful" "wizard")' 'wonderful and wizard'
+ test_query_syntax '(or "php" "wizard")' 'php or wizard'
+ test_query_syntax 'wizard' 'wizard'
+ test_query_syntax 'Wizard' 'Wizard'
+ test_query_syntax '(attachment notmuch-help.patch)' 'attachment:notmuch-help.patch'
+
+fi
+
test_done