1 Return-Path: <amdragon@mit.edu>
\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 0FB08431FB6
\r
6 for <notmuch@notmuchmail.org>; Tue, 4 Dec 2012 11:25:03 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 NrXC4SPhp556 for <notmuch@notmuchmail.org>;
\r
16 Tue, 4 Dec 2012 11:24:59 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 2D350431FAE
\r
20 for <notmuch@notmuchmail.org>; Tue, 4 Dec 2012 11:24:59 -0800 (PST)
\r
21 X-AuditID: 12074424-b7fe06d0000008f0-68-50be4e0983da
\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])
\r
23 by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id D7.E2.02288.90E4EB05; Tue, 4 Dec 2012 14:24:57 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id qB4JOvqS011845;
\r
27 Tue, 4 Dec 2012 14:24:57 -0500
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qB4JOtct010089
\r
32 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);
\r
33 Tue, 4 Dec 2012 14:24:56 -0500 (EST)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1Tfy6x-0001ow-2h; Tue, 04 Dec 2012 14:24:55 -0500
\r
37 From: Austin Clements <aclements@csail.mit.edu>
\r
38 To: Peter Feigl <craven@gmx.net>, notmuch@notmuchmail.org
\r
39 Subject: Re: [PATCH v2 4/5] Adding tests for --format=sexp.
\r
40 In-Reply-To: <1354632382-15609-5-git-send-email-craven@gmx.net>
\r
41 References: <1354632382-15609-1-git-send-email-craven@gmx.net>
\r
42 <1354632382-15609-5-git-send-email-craven@gmx.net>
\r
43 User-Agent: Notmuch/0.14+100~gcb9b0b0 (http://notmuchmail.org) Emacs/23.4.1
\r
45 Date: Tue, 04 Dec 2012 14:24:54 -0500
\r
46 Message-ID: <87a9tty60p.fsf@awakening.csail.mit.edu>
\r
48 Content-Type: text/plain; charset=utf-8
\r
49 Content-Transfer-Encoding: quoted-printable
\r
50 X-Brightmail-Tracker:
\r
51 H4sIAAAAAAAAA+NgFvrGIsWRmVeSWpSXmKPExsUixG6nosvpty/A4Mc0EYu9De2MFtdvzmR2
\r
52 YPJYvGk/m8ezVbeYA5iiuGxSUnMyy1KL9O0SuDIOHt3PWjDZvOLC5FvsDYz9Bl2MnBwSAiYS
\r
53 ez7vZYWwxSQu3FvP1sXIxSEksI9R4vbKTmYIZz2jxN9Zc9lAqoQELjBJzN8ZCGEvYZS43qIM
\r
54 YrMJ6EusWDsJbJKIgKXE1C+XgOo5OIQFrCXuL4gBCXMK2EtcnHSOGaK1UGLivR4WkBJRgXiJ
\r
55 y0sVQMIsAqoSk66sYQKxeYFu+3aigxnCFpQ4OfMJC4jNLKAu8WfeJWYIW1ti2cLXzBMYBWch
\r
56 KZuFpGwWkrIFjMyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdM31cjNL9FJTSjcxgoPXRWUHY/Mh
\r
57 pUOMAhyMSjy8Esb7AoRYE8uKK3MPMUpyMCmJ8v7zBArxJeWnVGYkFmfEF5XmpBYfYpTgYFYS
\r
58 4f1nB5TjTUmsrEotyodJSXOwKInzXk+56S8kkJ5YkpqdmlqQWgSTleHgUJLgne4D1ChYlJqe
\r
59 WpGWmVOCkGbi4AQZzgM0fC5IDW9xQWJucWY6RP4Uo6KUOG8DSEIAJJFRmgfXC0surxjFgV4R
\r
60 5uUGqeIBJia47ldAg5mABr8Q2g0yuCQRISXVwLgo3a25StW3lZ+VqeYEb1tKZq1Y6QSLiseK
\r
61 QdssnnfM5bJT6GuavO7c8uft67Pzm2xmuTbKXFR81MDIrFy0dOPaOW84I+a9Prbk6wwD9TiG
\r
62 Jp4Lk9UDT7I+M3fr4r8TfERykaDKi4DV+3//Uu+f+k9zguii4BLb+982vFOqydScFd9svn/j
\r
63 ciWW4oxEQy3mouJEAEdE04sJAwAA
\r
64 X-BeenThere: notmuch@notmuchmail.org
\r
65 X-Mailman-Version: 2.1.13
\r
67 List-Id: "Use and development of the notmuch mail system."
\r
68 <notmuch.notmuchmail.org>
\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
72 List-Post: <mailto:notmuch@notmuchmail.org>
\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
75 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
76 X-List-Received-Date: Tue, 04 Dec 2012 19:25:03 -0000
\r
78 It would be nice to use something like test_expect_equal_json for this
\r
79 (probably based on Emacs' pp function), but this is fine for now.
\r
81 On Tue, 04 Dec 2012, Peter Feigl <craven@gmx.net> wrote:
\r
82 > Add basic tests, the same as for json, for the S-Expression output
\r
85 > test/notmuch-test | 1 +
\r
86 > test/sexp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
\r
87 > 2 files changed, 49 insertions(+)
\r
88 > create mode 100755 test/sexp
\r
90 > diff --git a/test/notmuch-test b/test/notmuch-test
\r
91 > index a6ef34f..ca9c3dc 100755
\r
92 > --- a/test/notmuch-test
\r
93 > +++ b/test/notmuch-test
\r
94 > @@ -31,6 +31,7 @@ TESTS=3D"
\r
102 > diff --git a/test/sexp b/test/sexp
\r
103 > new file mode 100755
\r
104 > index 0000000..fdc9de6
\r
108 > +#!/usr/bin/env bash
\r
109 > +test_description=3D"--format=3Dsexp output"
\r
112 > +test_begin_subtest "Show message: sexp"
\r
113 > +add_message "[subject]=3D\"sexp-show-subject\"" "[date]=3D\"Sat, 01 Jan =
\r
114 2000 12:00:00 -0000\"" "[bcc]=3D\"test_suite+bcc@notmuchmail.org\"" "[reply=
\r
115 -to]=3D\"test_suite+replyto@notmuchmail.org\"" "[body]=3D\"sexp-show-messag=
\r
117 > +output=3D$(notmuch show --format=3Dsexp "sexp-show-message")
\r
118 > +test_expect_equal "$output" "(((((id \"msg-001@notmuch-test-suite\") (ma=
\r
119 tch t) (excluded nil) (filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail=
\r
120 /msg-001\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"i=
\r
121 nbox\" \"unread\")) (headers ((Subject \"sexp-show-subject\") (From \"Notmu=
\r
122 ch Test Suite <test_suite@notmuchmail.org>\") (To \"Notmuch Test Suite <tes=
\r
123 t_suite@notmuchmail.org>\") (Bcc \"test_suite+bcc@notmuchmail.org\") (Reply=
\r
124 -To \"test_suite+replyto@notmuchmail.org\") (Date \"Sat, 01 Jan 2000 12:00:=
\r
125 00 +0000\"))) (body (((id 1) (content-type \"text/plain\") (content \"sexp-=
\r
126 show-message\n\"))))) ())))"
\r
128 > +# This should be the same output as above.
\r
129 > +test_begin_subtest "Show message: sexp --body=3Dtrue"
\r
130 > +output=3D$(notmuch show --format=3Dsexp --body=3Dtrue "sexp-show-message=
\r
132 > +test_expect_equal "$output" "(((((id \"msg-001@notmuch-test-suite\") (ma=
\r
133 tch t) (excluded nil) (filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail=
\r
134 /msg-001\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"i=
\r
135 nbox\" \"unread\")) (headers ((Subject \"sexp-show-subject\") (From \"Notmu=
\r
136 ch Test Suite <test_suite@notmuchmail.org>\") (To \"Notmuch Test Suite <tes=
\r
137 t_suite@notmuchmail.org>\") (Bcc \"test_suite+bcc@notmuchmail.org\") (Reply=
\r
138 -To \"test_suite+replyto@notmuchmail.org\") (Date \"Sat, 01 Jan 2000 12:00:=
\r
139 00 +0000\"))) (body (((id 1) (content-type \"text/plain\") (content \"sexp-=
\r
140 show-message\n\"))))) ())))"
\r
142 > +test_begin_subtest "Show message: sexp --body=3Dfalse"
\r
143 > +output=3D$(notmuch show --format=3Dsexp --body=3Dfalse "sexp-show-messag=
\r
145 > +test_expect_equal "$output" "(((((id \"msg-001@notmuch-test-suite\") (ma=
\r
146 tch t) (excluded nil) (filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail=
\r
147 /msg-001\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"i=
\r
148 nbox\" \"unread\")) (headers ((Subject \"sexp-show-subject\") (From \"Notmu=
\r
149 ch Test Suite <test_suite@notmuchmail.org>\") (To \"Notmuch Test Suite <tes=
\r
150 t_suite@notmuchmail.org>\") (Bcc \"test_suite+bcc@notmuchmail.org\") (Reply=
\r
151 -To \"test_suite+replyto@notmuchmail.org\") (Date \"Sat, 01 Jan 2000 12:00:=
\r
152 00 +0000\")))) ())))"
\r
154 > +test_begin_subtest "Search message: sexp"
\r
155 > +add_message "[subject]=3D\"sexp-search-subject\"" "[date]=3D\"Sat, 01 Ja=
\r
156 n 2000 12:00:00 -0000\"" "[body]=3D\"sexp-search-message\""
\r
157 > +output=3D$(notmuch search --format=3Dsexp "sexp-search-message" | notmuc=
\r
159 > +test_expect_equal "$output" "(((thread \"0000000000000002\") (timestamp =
\r
160 946728000) (date_relative \"2000-01-01\") (matched 1) (total 1) (authors \"=
\r
161 Notmuch Test Suite\") (subject \"sexp-search-subject\") (tags (\"inbox\" \"=
\r
164 > +test_begin_subtest "Show message: sexp, utf-8"
\r
165 > +add_message "[subject]=3D\"sexp-show-utf8-body-s=C3=BCbj=C3=A9ct\"" "[da=
\r
166 te]=3D\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=3D\"js=C3=B6n-show-m=C3=
\r
168 > +output=3D$(notmuch show --format=3Dsexp "js=C3=B6n-show-m=C3=A9ssage")
\r
169 > +test_expect_equal "$output" "(((((id \"msg-003@notmuch-test-suite\") (ma=
\r
170 tch t) (excluded nil) (filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail=
\r
171 /msg-003\") (timestamp 946728000) (date_relative \"2000-01-01\") (tags (\"i=
\r
172 nbox\" \"unread\")) (headers ((Subject \"sexp-show-utf8-body-s=C3=BCbj=C3=
\r
173 =A9ct\") (From \"Notmuch Test Suite <test_suite@notmuchmail.org>\") (To \"N=
\r
174 otmuch Test Suite <test_suite@notmuchmail.org>\") (Date \"Sat, 01 Jan 2000 =
\r
175 12:00:00 +0000\"))) (body (((id 1) (content-type \"text/plain\") (content \=
\r
176 "js=C3=B6n-show-m=C3=A9ssage\n\"))))) ())))"
\r
178 > +test_begin_subtest "Show message: sexp, inline attachment filename"
\r
179 > +subject=3D'sexp-show-inline-attachment-filename'
\r
180 > +id=3D"sexp-show-inline-attachment-filename@notmuchmail.org"
\r
181 > +emacs_deliver_message \
\r
183 > + 'This is a test message with inline attachment with a filename' \
\r
184 > + "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\")
\r
185 > + (message-goto-eoh)
\r
186 > + (insert \"Message-ID: <$id>\n\")"
\r
187 > +output=3D$(notmuch show --format=3Dsexp "id:$id")
\r
188 > +filename=3D$(notmuch search --output=3Dfiles "id:$id")
\r
189 > +test_expect_equal "$output" "(((((id \"sexp-show-inline-attachment-filen=
\r
190 ame@notmuchmail.org\") (match t) (excluded nil) (filename \"$filename\") (t=
\r
191 imestamp 946728000) (date_relative \"2000-01-01\") (tags (\"inbox\")) (head=
\r
192 ers ((Subject \"sexp-show-inline-attachment-filename\") (From \"Notmuch Tes=
\r
193 t Suite <test_suite@notmuchmail.org>\") (To \"test_suite@notmuchmail.org\")=
\r
194 (Date \"Sat, 01 Jan 2000 12:00:00 +0000\"))) (body (((id 1) (content-type =
\r
195 \"multipart/mixed\") (content (((id 2) (content-type \"text/plain\") (conte=
\r
196 nt \"This is a test message with inline attachment with a filename\")) ((id=
\r
197 3) (content-type \"application/octet-stream\") (filename \"README\")))))))=
\r
200 > +test_begin_subtest "Search message: sexp, utf-8"
\r
201 > +add_message "[subject]=3D\"sexp-search-utf8-body-s=C3=BCbj=C3=A9ct\"" "[=
\r
202 date]=3D\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=3D\"js=C3=B6n-search-m=
\r
204 > +output=3D$(notmuch search --format=3Dsexp "js=C3=B6n-search-m=C3=A9ssage=
\r
205 " | notmuch_search_sanitize)
\r
206 > +test_expect_equal "$output" "(((thread \"0000000000000005\") (timestamp =
\r
207 946728000) (date_relative \"2000-01-01\") (matched 1) (total 1) (authors \"=
\r
208 Notmuch Test Suite\") (subject \"sexp-search-utf8-body-s=C3=BCbj=C3=A9ct\")=
\r
209 (tags (\"inbox\" \"unread\"))))"
\r
216 > _______________________________________________
\r
217 > notmuch mailing list
\r
218 > notmuch@notmuchmail.org
\r
219 > http://notmuchmail.org/mailman/listinfo/notmuch
\r