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 v9 16/17] test/tagging: add test for naked punctuation in tags; compare with quoting spaces.
Date: Sun, 23 Dec 2012 21:39:42 -0400	[thread overview]
Message-ID: <1356313183-9266-17-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1356313183-9266-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 |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/test/tagging b/test/tagging
index 5b48cb7..748d947 100755
--- a/test/tagging
+++ b/test/tagging
@@ -228,6 +228,30 @@ 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 parens need to be quoted"
+notmuch dump --format=batch-tag > BACKUP
+
+notmuch tag --batch <<EOF
++winner *
++foo::bar -- (One and Two) or (One and tag:winner)
++found::it -- tag:foo::bar
+# ignore this line and the next
+
++space%20in%20tags -- Two
+# hex encode tag '(tags)', among other stunts.
++crazy{ +%28tags%29 +&are +#possible\ -- tag:space%20in%20tags
++match*crazy -- tag:crazy{
+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 +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:[~2012-12-24  1:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-24  1:39 v9 of batch tagging david
2012-12-24  1:39 ` [Patch v9 01/17] parse_tag_line: use enum for return value david
2012-12-24  1:39 ` [Patch v9 02/17] tag-util: factor out rules for illegal tags, use in parse_tag_line david
2012-12-24  1:39 ` [Patch v9 03/17] notmuch-tag.c: convert to use tag-utils david
2012-12-24  1:39 ` [Patch v9 04/17] notmuch-tag: factor out double quoting routine david
2012-12-24  1:39 ` [Patch v9 05/17] util/string-util: add a new string tokenized function david
2012-12-24  1:39 ` [Patch v9 06/17] unhex_and_quote: new function to quote hex-decoded queries david
2012-12-24  1:39 ` [Patch v9 07/17] notmuch-restore: move query handling for batch restore to parser david
2012-12-24  1:39 ` [Patch v9 08/17] cli: add support for batch tagging operations to "notmuch tag" david
2012-12-24  1:39 ` [Patch v9 09/17] test/tagging: add test for error messages of tag --batch david
2012-12-24  1:39 ` [Patch v9 10/17] test/tagging: add basic tests for batch tagging functionality david
2012-12-24  1:39 ` [Patch v9 11/17] test/tagging: add tests for exotic tags david
2012-12-24  1:39 ` [Patch v9 12/17] test/tagging: add test for exotic message-ids and batch tagging david
2012-12-24  1:39 ` [Patch v9 13/17] test/tagging: add test for compound queries with " david
2012-12-24  1:39 ` [Patch v9 14/17] notmuch-tag.1: tidy synopsis formatting, reference david
2012-12-24  1:39 ` [Patch v9 15/17] man: document notmuch tag --batch, --input options david
2012-12-24  1:39 ` david [this message]
2012-12-24  1:39 ` [Patch v9 17/17] test/tagging: add test for handling of parenthesized tag queries david
2012-12-24  2:34 ` v9 of batch tagging Mark Walters
2012-12-24  3:31   ` 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=1356313183-9266-17-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).