1 Return-Path: <m.walters@qmul.ac.uk>
\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 82766431FB6
\r
6 for <notmuch@notmuchmail.org>; Thu, 6 Dec 2012 00:18:32 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id JMws9JjzeCnn for <notmuch@notmuchmail.org>;
\r
17 Thu, 6 Dec 2012 00:18:30 -0800 (PST)
\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 7F82F431FAE
\r
22 for <notmuch@notmuchmail.org>; Thu, 6 Dec 2012 00:18:30 -0800 (PST)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1TgWf2-0002IT-FD; Thu, 06 Dec 2012 08:18:26 +0000
\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)
\r
28 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)
\r
29 (envelope-from <m.walters@qmul.ac.uk>)
\r
30 id 1TgWf1-0007XD-UF; Thu, 06 Dec 2012 08:18:24 +0000
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: Peter Feigl <craven@gmx.net>, notmuch@notmuchmail.org
\r
33 Subject: Re: [PATCH v3 4/5] Adding tests for --format=sexp.
\r
34 In-Reply-To: <1354779189-12231-5-git-send-email-craven@gmx.net>
\r
35 References: <1354779189-12231-1-git-send-email-craven@gmx.net>
\r
36 <1354779189-12231-5-git-send-email-craven@gmx.net>
\r
37 User-Agent: Notmuch/0.14+81~g9730584 (http://notmuchmail.org) Emacs/23.4.1
\r
38 (x86_64-pc-linux-gnu)
\r
39 Date: Thu, 06 Dec 2012 08:18:28 +0000
\r
40 Message-ID: <87y5hbpp9n.fsf@qmul.ac.uk>
\r
42 Content-Type: text/plain; charset=utf-8
\r
43 Content-Transfer-Encoding: quoted-printable
\r
44 X-Sender-Host-Address: 93.97.24.31
\r
45 X-QM-SPAM-Info: Sender has good ham record. :)
\r
46 X-QM-Body-MD5: c56bcfe8ec65f4411b0c2760051ad77a (of first 20000 bytes)
\r
47 X-SpamAssassin-Score: -1.7
\r
48 X-SpamAssassin-SpamBar: -
\r
49 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
51 spam. We require at least 5.0 points to mark a message as spam.
\r
52 This message scored -1.7 points.
\r
53 Summary of the scoring:
\r
54 * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,
\r
56 * [138.37.6.40 listed in list.dnswl.org]
\r
57 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
58 provider * (markwalters1009[at]gmail.com)
\r
59 * 0.6 AWL AWL: From: address is in the auto white-list
\r
60 X-QM-Scan-Virus: ClamAV says the message is clean
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.13
\r
64 List-Id: "Use and development of the notmuch mail system."
\r
65 <notmuch.notmuchmail.org>
\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
69 List-Post: <mailto:notmuch@notmuchmail.org>
\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
73 X-List-Received-Date: Thu, 06 Dec 2012 08:18:32 -0000
\r
75 On Thu, 06 Dec 2012, Peter Feigl <craven@gmx.net> wrote:
\r
76 > Add basic tests, the same as for json, for the S-Expression output
\r
79 > test/notmuch-test | 1 +
\r
80 > test/sexp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
\r
81 > 2 files changed, 49 insertions(+)
\r
82 > create mode 100755 test/sexp
\r
84 > diff --git a/test/notmuch-test b/test/notmuch-test
\r
85 > index a6ef34f..ca9c3dc 100755
\r
86 > --- a/test/notmuch-test
\r
87 > +++ b/test/notmuch-test
\r
88 > @@ -31,6 +31,7 @@ TESTS=3D"
\r
96 > diff --git a/test/sexp b/test/sexp
\r
97 > new file mode 100755
\r
98 > index 0000000..335844e
\r
102 > +#!/usr/bin/env bash
\r
103 > +test_description=3D"--format=3Dsexp output"
\r
106 > +test_begin_subtest "Show message: sexp"
\r
107 > +add_message "[subject]=3D\"sexp-show-subject\"" "[date]=3D\"Sat, 01 Jan =
\r
108 2000 12:00:00 -0000\"" "[bcc]=3D\"test_suite+bcc@notmuchmail.org\"" "[reply=
\r
109 -to]=3D\"test_suite+replyto@notmuchmail.org\"" "[body]=3D\"sexp-show-messag=
\r
111 > +output=3D$(notmuch show --format=3Dsexp "sexp-show-message")
\r
112 > +test_expect_equal "$output" "((((:id \"msg-001@notmuch-test-suite\" :mat=
\r
113 ch t :excluded nil :filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail/ms=
\r
114 g-001\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\"=
\r
115 \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test =
\r
116 Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@n=
\r
117 otmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_=
\r
118 suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") =
\r
119 :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"=
\r
122 The :filename above is hardcoded (so will fail for most of us). I know
\r
123 there are some variables/functions for things like that but I am not
\r
124 sure exactly which bits need to be wrapped. I think message-id and
\r
125 thread-id are often a problem too.
\r
133 > +# This should be the same output as above.
\r
134 > +test_begin_subtest "Show message: sexp --body=3Dtrue"
\r
135 > +output=3D$(notmuch show --format=3Dsexp --body=3Dtrue "sexp-show-message=
\r
137 > +test_expect_equal "$output" "((((:id \"msg-001@notmuch-test-suite\" :mat=
\r
138 ch t :excluded nil :filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail/ms=
\r
139 g-001\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\"=
\r
140 \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test =
\r
141 Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@n=
\r
142 otmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_=
\r
143 suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") =
\r
144 :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"=
\r
147 > +test_begin_subtest "Show message: sexp --body=3Dfalse"
\r
148 > +output=3D$(notmuch show --format=3Dsexp --body=3Dfalse "sexp-show-messag=
\r
150 > +test_expect_equal "$output" "((((:id \"msg-001@notmuch-test-suite\" :mat=
\r
151 ch t :excluded nil :filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail/ms=
\r
152 g-001\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\"=
\r
153 \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test =
\r
154 Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@n=
\r
155 otmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_=
\r
156 suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\"))=
\r
159 > +test_begin_subtest "Search message: sexp"
\r
160 > +add_message "[subject]=3D\"sexp-search-subject\"" "[date]=3D\"Sat, 01 Ja=
\r
161 n 2000 12:00:00 -0000\"" "[body]=3D\"sexp-search-message\""
\r
162 > +output=3D$(notmuch search --format=3Dsexp "sexp-search-message" | notmuc=
\r
164 > +test_expect_equal "$output" "((:thread \"0000000000000002\" :timestamp 9=
\r
165 46728000 :date_relative \"2000-01-01\" :matched 1 :total 1 :authors \"Notmu=
\r
166 ch Test Suite\" :subject \"sexp-search-subject\" :tags (\"inbox\" \"unread\=
\r
169 > +test_begin_subtest "Show message: sexp, utf-8"
\r
170 > +add_message "[subject]=3D\"sexp-show-utf8-body-s=C3=BCbj=C3=A9ct\"" "[da=
\r
171 te]=3D\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=3D\"js=C3=B6n-show-m=C3=
\r
173 > +output=3D$(notmuch show --format=3Dsexp "js=C3=B6n-show-m=C3=A9ssage")
\r
174 > +test_expect_equal "$output" "((((:id \"msg-003@notmuch-test-suite\" :mat=
\r
175 ch t :excluded nil :filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail/ms=
\r
176 g-003\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\"=
\r
177 \"unread\") :headers (:Subject \"sexp-show-utf8-body-s=C3=BCbj=C3=A9ct\" :=
\r
178 >From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test=
\r
179 Suite <test_suite@notmuchmail.org>\" :Date \"Sat, 01 Jan 2000 12:00:00 +00=
\r
180 00\") :body ((:id 1 :content-type \"text/plain\" :content \"js=C3=B6n-show-=
\r
181 m=C3=A9ssage\n\"))) ())))"
\r
183 > +test_begin_subtest "Show message: sexp, inline attachment filename"
\r
184 > +subject=3D'sexp-show-inline-attachment-filename'
\r
185 > +id=3D"sexp-show-inline-attachment-filename@notmuchmail.org"
\r
186 > +emacs_deliver_message \
\r
188 > + 'This is a test message with inline attachment with a filename' \
\r
189 > + "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\")
\r
190 > + (message-goto-eoh)
\r
191 > + (insert \"Message-ID: <$id>\n\")"
\r
192 > +output=3D$(notmuch show --format=3Dsexp "id:$id")
\r
193 > +filename=3D$(notmuch search --output=3Dfiles "id:$id")
\r
194 > +test_expect_equal "$output" "((((:id \"sexp-show-inline-attachment-filen=
\r
195 ame@notmuchmail.org\" :match t :excluded nil :filename \"$filename\" :times=
\r
196 tamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\") :headers (:S=
\r
197 ubject \"sexp-show-inline-attachment-filename\" :From \"Notmuch Test Suite =
\r
198 <test_suite@notmuchmail.org>\" :To \"test_suite@notmuchmail.org\" :Date \"S=
\r
199 at, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"multipart/m=
\r
200 ixed\" :content ((:id 2 :content-type \"text/plain\" :content \"This is a t=
\r
201 est message with inline attachment with a filename\") (:id 3 :content-type =
\r
202 \"application/octet-stream\" :filename \"README\"))))) ())))"
\r
204 > +test_begin_subtest "Search message: sexp, utf-8"
\r
205 > +add_message "[subject]=3D\"sexp-search-utf8-body-s=C3=BCbj=C3=A9ct\"" "[=
\r
206 date]=3D\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=3D\"js=C3=B6n-search-m=
\r
208 > +output=3D$(notmuch search --format=3Dsexp "js=C3=B6n-search-m=C3=A9ssage=
\r
209 " | notmuch_search_sanitize)
\r
210 > +test_expect_equal "$output" "((:thread \"0000000000000005\" :timestamp 9=
\r
211 46728000 :date_relative \"2000-01-01\" :matched 1 :total 1 :authors \"Notmu=
\r
212 ch Test Suite\" :subject \"sexp-search-utf8-body-s=C3=BCbj=C3=A9ct\" :tags =
\r
213 (\"inbox\" \"unread\")))"
\r
220 > _______________________________________________
\r
221 > notmuch mailing list
\r
222 > notmuch@notmuchmail.org
\r
223 > http://notmuchmail.org/mailman/listinfo/notmuch
\r