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 v2 9/9] test/tagging: add test for naked punctuation in tags; compare with quoting spaces.
Date: Sun,  6 Jan 2013 23:16:54 -0400	[thread overview]
Message-ID: <1357528614-6413-10-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1357528614-6413-1-git-send-email-david@tethera.net>

From: David Bremner <bremner@debian.org>

This test also serves as documentation of the quoting
requirements. The comment lines are so that it exactly matches the man
page. Nothing more embarrassing than having an example in the man page
fail.
---
 test/tagging |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/test/tagging b/test/tagging
index 1717e72..1f5632c 100755
--- a/test/tagging
+++ b/test/tagging
@@ -198,6 +198,31 @@ notmuch dump --format=batch-tag | sort > OUTPUT
 notmuch restore --format=batch-tag < BACKUP
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "--batch: only space and % needs to be encoded."
+notmuch dump --format=batch-tag > BACKUP
+
+notmuch tag --batch <<EOF
++winner *
++foo::bar%25 -- (One and Two) or (One and tag:winner)
++found::it -- tag:foo::bar%
+# ignore this line and the next
+
++space%20in%20tags -- Two
+# add tag '(tags)', among other stunts.
++crazy{ +(tags) +&are +#possible\ -- tag:"space in tags"
++match*crazy -- tag:crazy{
++some_tag -- id:"this is ""nauty)"""
+EOF
+
+cat <<EOF > EXPECTED
++%23possible%5c +%26are +%28tags%29 +crazy%7b +inbox +match%2acrazy +space%20in%20tags +tag4 +tag5 +unread +winner -- id:msg-002@notmuch-test-suite
++foo%3a%3abar%25 +found%3a%3ait +inbox +tag5 +unread +winner -- id:msg-001@notmuch-test-suite
+EOF
+
+notmuch dump --format=batch-tag | sort > OUTPUT
+notmuch restore --format=batch-tag < BACKUP
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest '--batch: unicode message-ids'
 
 ${TEST_DIRECTORY}/random-corpus --config-path=${NOTMUCH_CONFIG} \
-- 
1.7.10.4

  parent reply	other threads:[~2013-01-07  3:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07  3:16 Xapian-quoting based batch tagging david
2013-01-07  3:16 ` [Patch v2 1/9] tag-util: factor out rules for illegal tags, use in parse_tag_line david
2013-01-07  3:16 ` [Patch v2 2/9] notmuch-tag.c: convert to use tag-utils david
2013-01-07 18:52   ` Jani Nikula
2013-01-07 20:30     ` Tomi Ollila
2013-01-07  3:16 ` [Patch v2 3/9] cli: add support for batch tagging operations to "notmuch tag" david
2013-01-07  3:16 ` [Patch v2 4/9] test/tagging: add test for error messages of tag --batch david
2013-01-07  3:16 ` [Patch v2 5/9] test/tagging: add basic tests for batch tagging functionality david
2013-01-07  3:16 ` [Patch v2 6/9] test/tagging: add tests for exotic tags david
2013-01-07  3:16 ` [Patch v2 7/9] test/tagging: add test for exotic message-ids and batch tagging david
2013-01-07  3:16 ` [Patch v2 8/9] man: document notmuch tag --batch, --input options david
2013-01-07  3:16 ` david [this message]
2013-01-07 18:53 ` Xapian-quoting based batch tagging Jani Nikula
2013-01-08  0:56 ` 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=1357528614-6413-10-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).