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 9374D431FBC
\r
6 for <notmuch@notmuchmail.org>; Thu, 29 Nov 2012 20:12:29 -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 PTngvCSTWvey for <notmuch@notmuchmail.org>;
\r
16 Thu, 29 Nov 2012 20:12:25 -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 EC7B0431FAF
\r
21 for <notmuch@notmuchmail.org>; Thu, 29 Nov 2012 20:12:24 -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 1TeHxc-0002tC-NJ; Fri, 30 Nov 2012 00:12:21 -0400
\r
28 Received: from bremner by zancas.localnet with local (Exim 4.80)
\r
29 (envelope-from <bremner@tethera.net>)
\r
30 id 1TeHxX-00037A-6k; Fri, 30 Nov 2012 00:12:15 -0400
\r
31 From: david@tethera.net
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [PATCH] test: add test for notmuch tag --batch option
\r
34 Date: Fri, 30 Nov 2012 00:11:59 -0400
\r
35 Message-Id: <1354248720-11899-1-git-send-email-david@tethera.net>
\r
36 X-Mailer: git-send-email 1.7.10.4
\r
37 In-Reply-To: <87pq31i9g1.fsf@qmul.ac.uk>
\r
38 References: <87pq31i9g1.fsf@qmul.ac.uk>
\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: Fri, 30 Nov 2012 04:12:29 -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
66 I decided to save restore the tags rather than have
\r
67 multiple input and output files here.
\r
69 test/tagging | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
\r
70 1 file changed, 50 insertions(+)
\r
72 diff --git a/test/tagging b/test/tagging
\r
73 index 980ff92..75552e8 100755
\r
76 @@ -46,6 +46,56 @@ test_expect_equal "$output" "\
\r
77 thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (:\" inbox tag1 unread)
\r
78 thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 unread)"
\r
80 +test_begin_subtest "--batch"
\r
81 +notmuch tag --batch <<EOF
\r
82 +# %20 is a space in tag
\r
83 +-:"%20 -tag1 +tag5 +tag6 -- One
\r
84 ++tag1 -tag1 -tag4 +tag4 -- Two
\r
88 +output=$(notmuch search \* | notmuch_search_sanitize)
\r
89 +test_expect_equal "$output" "\
\r
90 +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
\r
91 +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 unread)"
\r
93 +cat > batch.in <<EOF
\r
94 +# %20 is a space in tag
\r
95 ++%40 -tag5 +tag6 -- One
\r
96 ++tag1 -tag1 -tag4 +tag4 -- Two
\r
100 +cat > batch.expected <<EOF
\r
101 +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (@ inbox tag6 unread)
\r
102 +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag6 unread)
\r
105 +test_begin_subtest "--input"
\r
106 +notmuch dump > backup.tags.$test_count
\r
107 +notmuch tag --input=batch.in
\r
108 +notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count
\r
109 +notmuch restore < backup.tags.$test_count
\r
110 +test_expect_equal_file batch.expected OUTPUT.$test_count
\r
112 +test_begin_subtest "--batch --input"
\r
113 +notmuch dump > backup.tags.$test_count
\r
114 +notmuch tag --batch --input=batch.in
\r
115 +notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count
\r
116 +notmuch restore < backup.tags.$test_count
\r
117 +test_expect_equal_file batch.expected OUTPUT.$test_count
\r
119 +test_begin_subtest "--batch, blank lines and comments"
\r
120 +notmuch dump | sort > EXPECTED.$test_count
\r
121 +notmuch tag --batch <<EOF
\r
122 +# this line is a comment; the next has only white space
\r
125 +# the previous line is empty
\r
127 +notmuch dump | sort > OUTPUT.$test_count
\r
128 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
130 test_expect_code 1 "Empty tag names" 'notmuch tag + One'
\r
132 test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
\r