unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: david@tethera.net
To: notmuch@notmuchmail.org
Cc: David Bremner <bremner@debian.org>
Subject: [PATCH 05/11] test/tagging: add test for error messages of tag --batch
Date: Tue, 25 Dec 2012 15:42:41 -0400	[thread overview]
Message-ID: <1356464567-21779-6-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1356464567-21779-1-git-send-email-david@tethera.net>

From: David Bremner <bremner@debian.org>

This is based on the similar test for notmuch restore, but the parser
in batch tagging mode is less tolerant of a few cases, in particular
those tested by illegal_tag.
---
 test/tagging |   35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/test/tagging b/test/tagging
index 980ff92..cd16585 100755
--- a/test/tagging
+++ b/test/tagging
@@ -46,6 +46,41 @@ 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: checking error messages'
+notmuch dump --format=batch-tag > BACKUP
+notmuch tag --batch <<EOF 2>OUTPUT
+# the next line has a space
+ 
+# this line has no tag operations, but this is permitted in batch format.
+a
++0
++a +b
+# trailing whitespace
++a +b 
++c +d --
+# this is a harmless comment, do not yell about it.
+
+# the previous line was blank; also no yelling please
++%zz -- id:whatever
+# the next non-comment line should report an an empty tag error for
+# batch tagging, but not for restore
++ +e -- id:foo
++- -- id:foo
+EOF
+
+cat <<EOF > EXPECTED
+Warning: no query string [+0]
+Warning: no query string [+a +b]
+Warning: missing query string [+a +b ]
+Warning: no query string after -- [+c +d --]
+Warning: hex decoding of tag %zz failed [+%zz -- id:whatever]
+Warning: empty tag forbidden [+ +e -- id:foo]
+Warning: tag starting with '-' forbidden [+- -- id:foo]
+EOF
+
+notmuch restore --format=batch-tag < BACKUP
+test_expect_equal_file EXPECTED OUTPUT
+
 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

  parent reply	other threads:[~2012-12-25 19:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-25 19:42 Xapian-quoting based batch-tagging david
2012-12-25 19:42 ` [PATCH 01/11] parse_tag_line: use enum for return value david
2012-12-26 13:48   ` David Bremner
2012-12-25 19:42 ` [PATCH 02/11] tag-util: factor out rules for illegal tags, use in parse_tag_line david
2012-12-25 19:42 ` [PATCH 03/11] notmuch-tag.c: convert to use tag-utils david
2012-12-25 19:42 ` [PATCH 04/11] cli: add support for batch tagging operations to "notmuch tag" david
2013-01-03 18:42   ` Jani Nikula
2012-12-25 19:42 ` david [this message]
2012-12-25 19:42 ` [PATCH 06/11] test/tagging: add basic tests for batch tagging functionality david
2012-12-25 19:42 ` [PATCH 07/11] test/tagging: add tests for exotic tags david
2012-12-25 19:42 ` [PATCH 08/11] test/tagging: add test for exotic message-ids and batch tagging david
2012-12-25 19:42 ` [PATCH 09/11] notmuch-tag.1: tidy synopsis formatting, reference david
2012-12-26 13:48   ` David Bremner
2012-12-25 19:42 ` [PATCH 10/11] man: document notmuch tag --batch, --input options david
2012-12-25 19:42 ` [PATCH 11/11] test/tagging: add test for naked punctuation in tags; compare with quoting spaces david
2012-12-26  8:52 ` Xapian-quoting based batch-tagging Mark Walters
2012-12-26 13:23   ` David Bremner
2013-01-03 19:41     ` Jani Nikula
2013-01-04  5:32       ` Jameson Graef Rollins
2013-01-03 19:59 ` 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=1356464567-21779-6-git-send-email-david@tethera.net \
    --to=david@tethera.net \
    --cc=bremner@debian.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).