Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / 3e / 676687185732f52361b48d539720473f91415a
1 Return-Path: <tomi.ollila@iki.fi>\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 09DC1431FBC\r
6         for <notmuch@notmuchmail.org>; Thu, 29 Nov 2012 23:29:30 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 5gy9m94wfx1J for <notmuch@notmuchmail.org>;\r
16         Thu, 29 Nov 2012 23:29:25 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id F0335431FAF\r
19         for <notmuch@notmuchmail.org>; Thu, 29 Nov 2012 23:29:24 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id E419D1000E5;\r
22         Fri, 30 Nov 2012 09:29:20 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: david@tethera.net, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH] test: add test for notmuch tag --batch option\r
26 In-Reply-To: <1354248720-11899-1-git-send-email-david@tethera.net>\r
27 References: <87pq31i9g1.fsf@qmul.ac.uk>\r
28         <1354248720-11899-1-git-send-email-david@tethera.net>\r
29 User-Agent: Notmuch/0.14+116~g29fcdb5 (http://notmuchmail.org) Emacs/24.2.1\r
30         (x86_64-unknown-linux-gnu)\r
31 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
32         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
33         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
34 Date: Fri, 30 Nov 2012 09:29:20 +0200\r
35 Message-ID: <m2fw3rlfan.fsf@guru.guru-group.fi>\r
36 MIME-Version: 1.0\r
37 Content-Type: text/plain\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Fri, 30 Nov 2012 07:29:30 -0000\r
51 \r
52 On Fri, Nov 30 2012, david@tethera.net wrote:\r
53 \r
54 > From: Jani Nikula <jani@nikula.org>\r
55 >\r
56 > Basic test of functionality, along with all combinations of options.\r
57 >\r
58 > Modified extensively by David Bremner <david@tethera.net>\r
59 >\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
62 > ---\r
63 >\r
64 > Mark: good catch. \r
65 >\r
66 > I decided to save restore the tags rather than have\r
67 > multiple input and output files here.\r
68 >\r
69 >  test/tagging |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++\r
70 >  1 file changed, 50 insertions(+)\r
71 >\r
72 > diff --git a/test/tagging b/test/tagging\r
73 > index 980ff92..75552e8 100755\r
74 > --- a/test/tagging\r
75 > +++ b/test/tagging\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
79 >  \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
85 > +-tag6 One\r
86 > ++tag5 Two\r
87 > +EOF\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
92 > +\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
97 > +-tag5 +tag6 Two\r
98 > +EOF\r
99 > +\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
103 > +EOF\r
104 > +\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
111 \r
112 2 things for all of these test_expect_equal_file ...:s\r
113 \r
114 Generally, argument order is OUTPUT EXPECTED (the diff is harder to grasp\r
115 -- but changing the diff order in test_expect_equal_file is pretty easy...\r
116 (& I have some patches in preparation for that...)\r
117 \r
118 In case of failure. test_expect_equal_file does\r
119 \r
120   if diff -q "$file1" "$file2" >/dev/null ; then\r
121        test_ok_ "$test_subtest_name"\r
122   else\r
123        testname=$this_test.$test_count\r
124        cp "$file1" "$testname.$basename1"\r
125        cp "$file2" "$testname.$basename2"\r
126 \r
127 i.e. the $test_count is already in the files -- in these\r
128 cases that is duplicated...\r
129 \r
130 Tomi\r
131 \r
132 \r
133 > +test_begin_subtest "--batch --input"\r
134 > +notmuch dump > backup.tags.$test_count\r
135 > +notmuch tag --batch --input=batch.in\r
136 > +notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count\r
137 > +notmuch restore < backup.tags.$test_count\r
138 > +test_expect_equal_file batch.expected OUTPUT.$test_count\r
139 > +\r
140 > +test_begin_subtest "--batch, blank lines and comments"\r
141 > +notmuch dump | sort > EXPECTED.$test_count\r
142 > +notmuch tag --batch <<EOF\r
143 > +# this line is a comment; the next has only white space\r
144 > +      \r
145 > +\r
146 > +# the previous line is empty\r
147 > +EOF\r
148 > +notmuch dump | sort > OUTPUT.$test_count\r
149 > +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
150 > +\r
151 >  test_expect_code 1 "Empty tag names" 'notmuch tag + One'\r
152 >  \r
153 >  test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'\r
154 > -- \r
155 > 1.7.10.4\r