2 test_description='"notmuch count" for messages and threads'
7 # Note: The 'wc -l' results below are wrapped in arithmetic evaluation
8 # $((...)) to strip whitespace. This is for portability, as 'wc -l'
9 # emits whitespace on some BSD variants.
11 test_begin_subtest "message count is the default for notmuch count"
13 "$((`notmuch search --output=messages '*' | wc -l`))" \
16 test_begin_subtest "message count with --output=messages"
18 "$((`notmuch search --output=messages '*' | wc -l`))" \
19 "`notmuch count --output=messages '*'`"
21 test_begin_subtest "thread count with --output=threads"
23 "$((`notmuch search --output=threads '*' | wc -l`))" \
24 "`notmuch count --output=threads '*'`"
26 test_begin_subtest "thread count is the default for notmuch search"
28 "$((`notmuch search '*' | wc -l`))" \
29 "`notmuch count --output=threads '*'`"
31 test_begin_subtest "count with no matching messages"
34 "`notmuch count --output=messages from:cworth and not from:cworth`"
36 test_begin_subtest "count with no matching threads"
39 "`notmuch count --output=threads from:cworth and not from:cworth`"
41 test_begin_subtest "message count is the default for batch count"
42 notmuch count --batch >OUTPUT <<EOF
46 notmuch count --output=messages >EXPECTED
47 notmuch count --output=messages from:cworth >>EXPECTED
48 test_expect_equal_file EXPECTED OUTPUT
50 test_begin_subtest "batch message count"
51 notmuch count --batch --output=messages >OUTPUT <<EOF
56 notmuch count --output=messages from:cworth >EXPECTED
57 notmuch count --output=messages >>EXPECTED
58 notmuch count --output=messages tag:inbox >>EXPECTED
59 test_expect_equal_file EXPECTED OUTPUT
61 test_begin_subtest "batch thread count"
62 notmuch count --batch --output=threads >OUTPUT <<EOF
65 from:cworth and not from:cworth
68 notmuch count --output=threads >EXPECTED
69 notmuch count --output=threads from:cworth >>EXPECTED
70 notmuch count --output=threads from:cworth and not from:cworth >>EXPECTED
71 notmuch count --output=threads foo >>EXPECTED
72 test_expect_equal_file EXPECTED OUTPUT
74 test_begin_subtest "batch message count with input file"
80 notmuch count --input=INPUT --output=messages >OUTPUT
81 notmuch count --output=messages from:cworth >EXPECTED
82 notmuch count --output=messages >>EXPECTED
83 notmuch count --output=messages tag:inbox >>EXPECTED
84 test_expect_equal_file EXPECTED OUTPUT