From: david@tethera.net
To: notmuch@notmuchmail.org
Subject: [Patch v6 4/6] test: add test for notmuch tag --batch option
Date: Sun, 9 Dec 2012 19:33:26 -0400 [thread overview]
Message-ID: <1355096008-4544-5-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1355096008-4544-1-git-send-email-david@tethera.net>
From: Jani Nikula <jani@nikula.org>
Basic test of functionality, along with all combinations of options.
Modified extensively by David Bremner <david@tethera.net>
The choice of @ as a tag is intended to be non-alphanumeric, but still
not too much trouble in the shell and in the old sup dump/restore format.
---
test/tagging | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/test/tagging b/test/tagging
index 980ff92..0f3d797 100755
--- a/test/tagging
+++ b/test/tagging
@@ -46,6 +46,57 @@ test_expect_equal "$output" "\
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (:\" inbox tag1 unread)
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 unread)"
+test_begin_subtest "--batch"
+notmuch tag --batch <<EOF
+# %20 is a space in tag
+-:"%20 -tag1 +tag5 +tag6 -- One
++tag1 -tag1 -tag4 +tag4 -- Two
+-tag6 One
++tag5 Two
+EOF
+output=$(notmuch search \* | notmuch_search_sanitize)
+test_expect_equal "$output" "\
+thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
+thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 unread)"
+
+# generate a common input file for the next several tests.
+cat > batch.in <<EOF
+# %40 is an @ in tag
++%40 -tag5 +tag6 -- One
++tag1 -tag1 -tag4 +tag4 -- Two
+-tag5 +tag6 Two
+EOF
+
+cat > batch.expected <<EOF
+thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (@ inbox tag6 unread)
+thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag6 unread)
+EOF
+
+test_begin_subtest "--input"
+notmuch dump --format=batch-tag > backup.tags
+notmuch tag --input=batch.in
+notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count
+notmuch restore --format=batch-tag < backup.tags
+test_expect_equal_file batch.expected OUTPUT.$test_count
+
+test_begin_subtest "--batch --input"
+notmuch dump --format=batch-tag > backup.tags
+notmuch tag --batch --input=batch.in
+notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count
+notmuch restore --format=batch-tag < backup.tags
+test_expect_equal_file batch.expected OUTPUT.$test_count
+
+test_begin_subtest "--batch, blank lines and comments"
+notmuch dump | sort > EXPECTED.$test_count
+notmuch tag --batch <<EOF
+# this line is a comment; the next has only white space
+
+
+# the previous line is empty
+EOF
+notmuch dump | sort > OUTPUT.$test_count
+test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+
test_expect_code 1 "Empty tag names" 'notmuch tag + One'
test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
--
1.7.10.4
next prev parent reply other threads:[~2012-12-09 23:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-09 23:33 V6 batch tagging patches david
2012-12-09 23:33 ` [Patch v6 1/6] tag-util: factor out rules for illegal tags, use in parse_tag_line david
2012-12-10 20:55 ` Jani Nikula
2012-12-13 22:07 ` Mark Walters
2012-12-15 12:39 ` David Bremner
2012-12-09 23:33 ` [Patch v6 2/6] notmuch-tag.c: convert to use tag-utils david
2012-12-10 21:18 ` Jani Nikula
2012-12-10 21:51 ` Jani Nikula
2012-12-09 23:33 ` [Patch v6 3/6] cli: add support for batch tagging operations to "notmuch tag" david
2012-12-10 21:29 ` Jani Nikula
2012-12-09 23:33 ` david [this message]
2012-12-10 21:31 ` [Patch v6 4/6] test: add test for notmuch tag --batch option Jani Nikula
2012-12-09 23:33 ` [Patch v6 5/6] notmuch-tag.1: tidy synopsis formatting david
2012-12-10 21:32 ` Jani Nikula
2012-12-09 23:33 ` [Patch v6 6/6] man: document notmuch tag --batch, --input options david
2012-12-10 21:34 ` Jani Nikula
2012-12-10 0:59 ` V6 batch tagging patches David Bremner
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=1355096008-4544-5-git-send-email-david@tethera.net \
--to=david@tethera.net \
--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).