Re: Avoiding the "huge INBOX of death"
[notmuch-archives.git] / ef / c26a3a9b9871dca3539dff704fe6203a81d128
1 Return-Path: <jani@nikula.org>\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 8733A431FAF\r
6         for <notmuch@notmuchmail.org>; Sat,  1 Dec 2012 16:06:27 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 R27eZCrTp7m4 for <notmuch@notmuchmail.org>;\r
16         Sat,  1 Dec 2012 16:06:23 -0800 (PST)\r
17 Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com\r
18         [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 9F2FB431FBC\r
21         for <notmuch@notmuchmail.org>; Sat,  1 Dec 2012 16:06:22 -0800 (PST)\r
22 Received: by mail-lb0-f181.google.com with SMTP id ge1so1533590lbb.26\r
23         for <notmuch@notmuchmail.org>; Sat, 01 Dec 2012 16:06:21 -0800 (PST)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=google.com; s=20120113;\r
26         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
27         :mime-version:content-type:x-gm-message-state;\r
28         bh=sLrnMgbnU3wDrN3r99B6O5XpsiHb20Bk1S7FLltorXs=;\r
29         b=Zqw6Wr5Gv+hgIR2Ir13xuukedMfobtIGS6d1vOipDTlY0bciuMsE2keoehJXtIU2oK\r
30         O6GaI91jEiW+f66Zv93VEandq3mLuMHNHpbSJpqcoKt7AUVR8mxWOHGTMU2MxhcRX27m\r
31         fSp/gwzI7H3NQE3x9wRgmlAM+BheZ8nt97nw799P3JUBXh69WLiBS6YU6zFv/Z0h42VO\r
32         Kumi5JtiVT0JsYhXzNE8UymfYwYlO6LG/Wav6iUgwIOnJ+KCCFnI3IrvAB2v8ma5BGXt\r
33         XDI28ULyx5ls7yPMPXtooRmIY6WkQxWdANdmARf4Mo3mnfhzdmd3Tn+txwyvPeiNlPt1\r
34         holA==\r
35 Received: by 10.152.104.77 with SMTP id gc13mr5359557lab.16.1354406780793;\r
36         Sat, 01 Dec 2012 16:06:20 -0800 (PST)\r
37 Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
38         [80.223.81.27])\r
39         by mx.google.com with ESMTPS id l9sm3615478lbf.7.2012.12.01.16.06.19\r
40         (version=SSLv3 cipher=OTHER); Sat, 01 Dec 2012 16:06:19 -0800 (PST)\r
41 From: Jani Nikula <jani@nikula.org>\r
42 To: david@tethera.net, notmuch@notmuchmail.org\r
43 Subject: Re: [PATCH] test: add test for notmuch tag --batch option\r
44 In-Reply-To: <1354248720-11899-1-git-send-email-david@tethera.net>\r
45 References: <87pq31i9g1.fsf@qmul.ac.uk>\r
46         <1354248720-11899-1-git-send-email-david@tethera.net>\r
47 User-Agent: Notmuch/0.14+124~g3b17402 (http://notmuchmail.org) Emacs/23.4.1\r
48         (i686-pc-linux-gnu)\r
49 Date: Sun, 02 Dec 2012 02:06:17 +0200\r
50 Message-ID: <87pq2tqpvq.fsf@nikula.org>\r
51 MIME-Version: 1.0\r
52 Content-Type: text/plain; charset=us-ascii\r
53 X-Gm-Message-State:\r
54  ALoCoQkg7Epbssl+OX9LJVB7uPKsxdXLQ8gwixNBCIKs//2sHTe9AGLZ8Mit6zz/VbKnEbW5hvIz\r
55 X-BeenThere: notmuch@notmuchmail.org\r
56 X-Mailman-Version: 2.1.13\r
57 Precedence: list\r
58 List-Id: "Use and development of the notmuch mail system."\r
59         <notmuch.notmuchmail.org>\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
63 List-Post: <mailto:notmuch@notmuchmail.org>\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
67 X-List-Received-Date: Sun, 02 Dec 2012 00:06:27 -0000\r
68 \r
69 On Fri, 30 Nov 2012, david@tethera.net wrote:\r
70 > From: Jani Nikula <jani@nikula.org>\r
71 >\r
72 > Basic test of functionality, along with all combinations of options.\r
73 >\r
74 > Modified extensively by David Bremner <david@tethera.net>\r
75 >\r
76 > The choice of @ as a tag is intended to be non-alphanumeric, but still\r
77 > not too much trouble in the shell and in the old sup dump/restore format.\r
78 > ---\r
79 >\r
80 > Mark: good catch. \r
81 >\r
82 > I decided to save restore the tags rather than have\r
83 > multiple input and output files here.\r
84 \r
85 But you have to be careful to not add any fancy tags as we're still\r
86 using the sup dump format here.\r
87 \r
88 >\r
89 >  test/tagging |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++\r
90 >  1 file changed, 50 insertions(+)\r
91 >\r
92 > diff --git a/test/tagging b/test/tagging\r
93 > index 980ff92..75552e8 100755\r
94 > --- a/test/tagging\r
95 > +++ b/test/tagging\r
96 > @@ -46,6 +46,56 @@ test_expect_equal "$output" "\\r
97 >  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (:\"  inbox tag1 unread)\r
98 >  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 unread)"\r
99 >  \r
100 > +test_begin_subtest "--batch"\r
101 > +notmuch tag --batch <<EOF\r
102 > +# %20 is a space in tag\r
103 > +-:"%20 -tag1 +tag5 +tag6 -- One\r
104 > ++tag1 -tag1 -tag4 +tag4 -- Two\r
105 > +-tag6 One\r
106 > ++tag5 Two\r
107 > +EOF\r
108 > +output=$(notmuch search \* | notmuch_search_sanitize)\r
109 > +test_expect_equal "$output" "\\r
110 > +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)\r
111 > +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 unread)"\r
112 > +\r
113 \r
114 Perhaps add a comment here that the generated files are used for more\r
115 than one subtest.\r
116 \r
117 > +cat > batch.in  <<EOF\r
118 > +# %20 is a space in tag\r
119 \r
120 True, but what's it got to do with this bit? :p\r
121 \r
122 BR,\r
123 Jani.\r
124 \r
125 > ++%40 -tag5 +tag6 -- One\r
126 > ++tag1 -tag1 -tag4 +tag4 -- Two\r
127 > +-tag5 +tag6 Two\r
128 > +EOF\r
129 > +\r
130 > +cat > batch.expected <<EOF\r
131 > +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (@ inbox tag6 unread)\r
132 > +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag6 unread)\r
133 > +EOF\r
134 > +\r
135 > +test_begin_subtest "--input"\r
136 > +notmuch dump > backup.tags.$test_count\r
137 > +notmuch tag --input=batch.in\r
138 > +notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count\r
139 > +notmuch restore < backup.tags.$test_count\r
140 > +test_expect_equal_file batch.expected OUTPUT.$test_count\r
141 > +\r
142 > +test_begin_subtest "--batch --input"\r
143 > +notmuch dump > backup.tags.$test_count\r
144 > +notmuch tag --batch --input=batch.in\r
145 > +notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count\r
146 > +notmuch restore < backup.tags.$test_count\r
147 > +test_expect_equal_file batch.expected OUTPUT.$test_count\r
148 > +\r
149 > +test_begin_subtest "--batch, blank lines and comments"\r
150 > +notmuch dump | sort > EXPECTED.$test_count\r
151 > +notmuch tag --batch <<EOF\r
152 > +# this line is a comment; the next has only white space\r
153 > +      \r
154 > +\r
155 > +# the previous line is empty\r
156 > +EOF\r
157 > +notmuch dump | sort > OUTPUT.$test_count\r
158 > +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
159 > +\r
160 >  test_expect_code 1 "Empty tag names" 'notmuch tag + One'\r
161 >  \r
162 >  test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'\r
163 > -- \r
164 > 1.7.10.4\r