X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=test%2FT060-count.sh;h=6ad80df99724ba9293a6853ecae35004f7cd66eb;hb=d9a2b900b6525874b913276af91840983d81b3f1;hp=0c0bf47309e930477f0b69fafeb93130f747fd3c;hpb=a863de1e43ee34f6f5794a2759fdceb287e851aa;p=notmuch diff --git a/test/T060-count.sh b/test/T060-count.sh index 0c0bf473..6ad80df9 100755 --- a/test/T060-count.sh +++ b/test/T060-count.sh @@ -95,7 +95,8 @@ test_expect_equal_file EXPECTED OUTPUT backup_database test_begin_subtest "error message for database open" -dd if=/dev/zero of="${MAIL_DIR}/.notmuch/xapian/postlist.${db_ending}" count=3 +target=(${MAIL_DIR}/.notmuch/xapian/postlist.*) +dd if=/dev/zero of="$target" count=3 notmuch count '*' 2>OUTPUT 1>/dev/null output=$(sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' OUTPUT) test_expect_equal "${output}" "A Xapian exception occurred opening database" @@ -107,7 +108,7 @@ set logging file count-files-gdb.log set logging on break count_files commands -shell cp /dev/null ${MAIL_DIR}/.notmuch/xapian/postlist.${db_ending} +shell cp /dev/null ${MAIL_DIR}/.notmuch/xapian/postlist.* continue end run @@ -153,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