1 Return-Path: <bremner@tethera.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id E6F09431FBC
\r
6 for <notmuch@notmuchmail.org>; Sun, 9 Dec 2012 15:33:59 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id Rm4HjP2SyTke for <notmuch@notmuchmail.org>;
\r
16 Sun, 9 Dec 2012 15:33:58 -0800 (PST)
\r
17 Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])
\r
18 (using TLSv1 with cipher AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 14708429E2E
\r
21 for <notmuch@notmuchmail.org>; Sun, 9 Dec 2012 15:33:54 -0800 (PST)
\r
22 Received: from fctnnbsc30w-142167090129.dhcp-dynamic.fibreop.nb.bellaliant.net
\r
23 ([142.167.90.129] helo=zancas.localnet)
\r
24 by tesseract.cs.unb.ca with esmtpsa
\r
25 (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72)
\r
26 (envelope-from <bremner@tethera.net>)
\r
27 id 1ThqNc-0007TJ-KR; Sun, 09 Dec 2012 19:33:53 -0400
\r
28 Received: from bremner by zancas.localnet with local (Exim 4.80)
\r
29 (envelope-from <bremner@tethera.net>)
\r
30 id 1ThqNX-0001Dp-2z; Sun, 09 Dec 2012 19:33:47 -0400
\r
31 From: david@tethera.net
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [Patch v6 4/6] test: add test for notmuch tag --batch option
\r
34 Date: Sun, 9 Dec 2012 19:33:26 -0400
\r
35 Message-Id: <1355096008-4544-5-git-send-email-david@tethera.net>
\r
36 X-Mailer: git-send-email 1.7.10.4
\r
37 In-Reply-To: <1355096008-4544-1-git-send-email-david@tethera.net>
\r
38 References: <1355096008-4544-1-git-send-email-david@tethera.net>
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Sun, 09 Dec 2012 23:34:00 -0000
\r
54 From: Jani Nikula <jani@nikula.org>
\r
56 Basic test of functionality, along with all combinations of options.
\r
58 Modified extensively by David Bremner <david@tethera.net>
\r
60 The choice of @ as a tag is intended to be non-alphanumeric, but still
\r
61 not too much trouble in the shell and in the old sup dump/restore format.
\r
63 test/tagging | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
\r
64 1 file changed, 51 insertions(+)
\r
66 diff --git a/test/tagging b/test/tagging
\r
67 index 980ff92..0f3d797 100755
\r
70 @@ -46,6 +46,57 @@ test_expect_equal "$output" "\
\r
71 thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (:\" inbox tag1 unread)
\r
72 thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 unread)"
\r
74 +test_begin_subtest "--batch"
\r
75 +notmuch tag --batch <<EOF
\r
76 +# %20 is a space in tag
\r
77 +-:"%20 -tag1 +tag5 +tag6 -- One
\r
78 ++tag1 -tag1 -tag4 +tag4 -- Two
\r
82 +output=$(notmuch search \* | notmuch_search_sanitize)
\r
83 +test_expect_equal "$output" "\
\r
84 +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
\r
85 +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 unread)"
\r
87 +# generate a common input file for the next several tests.
\r
88 +cat > batch.in <<EOF
\r
89 +# %40 is an @ in tag
\r
90 ++%40 -tag5 +tag6 -- One
\r
91 ++tag1 -tag1 -tag4 +tag4 -- Two
\r
95 +cat > batch.expected <<EOF
\r
96 +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (@ inbox tag6 unread)
\r
97 +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag6 unread)
\r
100 +test_begin_subtest "--input"
\r
101 +notmuch dump --format=batch-tag > backup.tags
\r
102 +notmuch tag --input=batch.in
\r
103 +notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count
\r
104 +notmuch restore --format=batch-tag < backup.tags
\r
105 +test_expect_equal_file batch.expected OUTPUT.$test_count
\r
107 +test_begin_subtest "--batch --input"
\r
108 +notmuch dump --format=batch-tag > backup.tags
\r
109 +notmuch tag --batch --input=batch.in
\r
110 +notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count
\r
111 +notmuch restore --format=batch-tag < backup.tags
\r
112 +test_expect_equal_file batch.expected OUTPUT.$test_count
\r
114 +test_begin_subtest "--batch, blank lines and comments"
\r
115 +notmuch dump | sort > EXPECTED.$test_count
\r
116 +notmuch tag --batch <<EOF
\r
117 +# this line is a comment; the next has only white space
\r
120 +# the previous line is empty
\r
122 +notmuch dump | sort > OUTPUT.$test_count
\r
123 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
125 test_expect_code 1 "Empty tag names" 'notmuch tag + One'
\r
127 test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
\r