unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH v6 5/6] test: add tests for notmuch count
Date: Sun, 13 Nov 2011 23:15:34 +0200	[thread overview]
Message-ID: <47268332a6d9162c18928444dc5c91078b8ee4c5.1321217854.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1321217854.git.jani@nikula.org>
In-Reply-To: <cover.1321217854.git.jani@nikula.org>

Signed-off-by: Jani Nikula <jani@nikula.org>
---
 test/count        |   40 ++++++++++++++++++++++++++++++++++++++++
 test/notmuch-test |    1 +
 2 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100755 test/count

diff --git a/test/count b/test/count
new file mode 100755
index 0000000..300b171
--- /dev/null
+++ b/test/count
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+test_description='"notmuch count" for messages and threads'
+. ./test-lib.sh
+
+add_email_corpus
+
+SEARCH="\"*\""
+
+test_begin_subtest "message count is the default for notmuch count"
+test_expect_equal \
+    "`notmuch search --output=messages ${SEARCH} | wc -l`" \
+    "`notmuch count ${SEARCH}`"
+
+test_begin_subtest "message count with --output=messages"
+test_expect_equal \
+    "`notmuch search --output=messages ${SEARCH} | wc -l`" \
+    "`notmuch count --output=messages ${SEARCH}`"
+
+test_begin_subtest "thread count with --output=threads"
+test_expect_equal \
+    "`notmuch search --output=threads ${SEARCH} | wc -l`" \
+    "`notmuch count --output=threads ${SEARCH}`"
+
+test_begin_subtest "thread count is the default for notmuch search"
+test_expect_equal \
+    "`notmuch search ${SEARCH} | wc -l`" \
+    "`notmuch count --output=threads ${SEARCH}`"
+
+SEARCH="from:cworth and not from:cworth"
+test_begin_subtest "count with no matching messages"
+test_expect_equal \
+    "0" \
+    "`notmuch count --output=messages ${SEARCH}`"
+
+test_begin_subtest "count with no matching threads"
+test_expect_equal \
+    "0" \
+    "`notmuch count --output=threads ${SEARCH}`"
+
+test_done
diff --git a/test/notmuch-test b/test/notmuch-test
index 738f8f6..587adb5 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -19,6 +19,7 @@ cd $(dirname "$0")
 TESTS="
   basic
   new
+  count
   search
   search-output
   search-by-folder
-- 
1.7.5.4

  parent reply	other threads:[~2011-11-13 21:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-13 21:15 [PATCH v6 0/6] lib/cli: limit number of messages in search results Jani Nikula
2011-11-13 21:15 ` [PATCH v6 1/6] lib: add function to get the number of threads matching a search Jani Nikula
2011-11-13 21:15 ` [PATCH v6 2/6] cli: add options --first and --maxitems to notmuch search Jani Nikula
2011-11-13 23:12   ` Jameson Graef Rollins
2011-11-14 10:34     ` Jani Nikula
2011-11-15  1:20       ` David Bremner
2011-11-13 21:15 ` [PATCH v6 3/6] cli: drop unused code from notmuch count Jani Nikula
2011-11-13 21:15 ` [PATCH v6 4/6] cli: add support for --output parameter in " Jani Nikula
2011-11-13 21:15 ` Jani Nikula [this message]
2011-11-13 21:15 ` [PATCH v6 6/6] test: add tests for notmuch search --first and --maxitems Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47268332a6d9162c18928444dc5c91078b8ee4c5.1321217854.git.jani@nikula.org \
    --to=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).