]> git.notmuchmail.org Git - notmuch/blob - test/count
test: add tests for notmuch count
[notmuch] / test / count
1 #!/usr/bin/env bash
2 test_description='"notmuch count" for messages and threads'
3 . ./test-lib.sh
4
5 add_email_corpus
6
7 SEARCH="\"*\""
8
9 test_begin_subtest "message count is the default for notmuch count"
10 test_expect_equal \
11     "`notmuch search --output=messages ${SEARCH} | wc -l`" \
12     "`notmuch count ${SEARCH}`"
13
14 test_begin_subtest "message count with --output=messages"
15 test_expect_equal \
16     "`notmuch search --output=messages ${SEARCH} | wc -l`" \
17     "`notmuch count --output=messages ${SEARCH}`"
18
19 test_begin_subtest "thread count with --output=threads"
20 test_expect_equal \
21     "`notmuch search --output=threads ${SEARCH} | wc -l`" \
22     "`notmuch count --output=threads ${SEARCH}`"
23
24 test_begin_subtest "thread count is the default for notmuch search"
25 test_expect_equal \
26     "`notmuch search ${SEARCH} | wc -l`" \
27     "`notmuch count --output=threads ${SEARCH}`"
28
29 SEARCH="from:cworth and not from:cworth"
30 test_begin_subtest "count with no matching messages"
31 test_expect_equal \
32     "0" \
33     "`notmuch count --output=messages ${SEARCH}`"
34
35 test_begin_subtest "count with no matching threads"
36 test_expect_equal \
37     "0" \
38     "`notmuch count --output=threads ${SEARCH}`"
39
40 test_done