+
+if [ "${NOTMUCH_HAVE_SFSEXP-0}" = "1" ]; then
+
+ count=$(notmuch count --lastmod '*' | cut -f 3)
+ for query in '()' '(not)' '(and)' '(or ())' '(or (not))' '(or (and))' \
+ '(or (and) (or) (not (and)))'; do
+ test_begin_subtest "reindex all messages: $query"
+ notmuch reindex --query=sexp "$query"
+ output=$(notmuch count --lastmod '*' | cut -f 3)
+ count=$((count + 1))
+ test_expect_equal "$output" "$count"
+ done
+
+fi
+