1 Return-Path: <jrollins@servo.finestructure.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 BE908429E32
\r
6 for <notmuch@notmuchmail.org>; Sat, 28 May 2011 14:52:33 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5
\r
12 tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_MED=-2.3]
\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 z12iBzBGJQWJ for <notmuch@notmuchmail.org>;
\r
17 Sat, 28 May 2011 14:52:30 -0700 (PDT)
\r
18 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu
\r
20 by olra.theworths.org (Postfix) with ESMTP id BEA4F429E40
\r
21 for <notmuch@notmuchmail.org>; Sat, 28 May 2011 14:52:17 -0700 (PDT)
\r
22 Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])
\r
23 by earth-doxen-postvirus (Postfix) with ESMTP id 4738366E02C5;
\r
24 Sat, 28 May 2011 14:52:16 -0700 (PDT)
\r
25 X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new
\r
26 Received: from servo.finestructure.net (cpe-98-149-172-122.socal.res.rr.com
\r
27 [98.149.172.122]) (Authenticated sender: jrollins)
\r
28 by earth-doxen-submit (Postfix) with ESMTP id D351266E019B;
\r
29 Sat, 28 May 2011 14:52:12 -0700 (PDT)
\r
30 Received: by servo.finestructure.net (Postfix, from userid 1000)
\r
31 id 626BD99E; Sat, 28 May 2011 14:52:05 -0700 (PDT)
\r
32 From: Jameson Graef Rollins <jrollins@finestructure.net>
\r
33 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
34 Subject: [PATCH 24/25] test: modify multipart test to use
\r
35 test_expect_equal_file
\r
36 Date: Sat, 28 May 2011 14:51:59 -0700
\r
37 Message-Id: <1306619520-25730-25-git-send-email-jrollins@finestructure.net>
\r
38 X-Mailer: git-send-email 1.7.4.4
\r
39 In-Reply-To: <1306619520-25730-24-git-send-email-jrollins@finestructure.net>
\r
40 References: <1306619520-25730-1-git-send-email-jrollins@finestructure.net>
\r
41 <1306619520-25730-2-git-send-email-jrollins@finestructure.net>
\r
42 <1306619520-25730-3-git-send-email-jrollins@finestructure.net>
\r
43 <1306619520-25730-4-git-send-email-jrollins@finestructure.net>
\r
44 <1306619520-25730-5-git-send-email-jrollins@finestructure.net>
\r
45 <1306619520-25730-6-git-send-email-jrollins@finestructure.net>
\r
46 <1306619520-25730-7-git-send-email-jrollins@finestructure.net>
\r
47 <1306619520-25730-8-git-send-email-jrollins@finestructure.net>
\r
48 <1306619520-25730-9-git-send-email-jrollins@finestructure.net>
\r
49 <1306619520-25730-10-git-send-email-jrollins@finestructure.net>
\r
50 <1306619520-25730-11-git-send-email-jrollins@finestructure.net>
\r
51 <1306619520-25730-12-git-send-email-jrollins@finestructure.net>
\r
52 <1306619520-25730-13-git-send-email-jrollins@finestructure.net>
\r
53 <1306619520-25730-14-git-send-email-jrollins@finestructure.net>
\r
54 <1306619520-25730-15-git-send-email-jrollins@finestructure.net>
\r
55 <1306619520-25730-16-git-send-email-jrollins@finestructure.net>
\r
56 <1306619520-25730-17-git-send-email-jrollins@finestructure.net>
\r
57 <1306619520-25730-18-git-send-email-jrollins@finestructure.net>
\r
58 <1306619520-25730-19-git-send-email-jrollins@finestructure.net>
\r
59 <1306619520-25730-20-git-send-email-jrollins@finestructure.net>
\r
60 <1306619520-25730-21-git-send-email-jrollins@finestructure.net>
\r
61 <1306619520-25730-22-git-send-email-jrollins@finestructure.net>
\r
62 <1306619520-25730-23-git-send-email-jrollins@finestructure.net>
\r
63 <1306619520-25730-24-git-send-email-jrollins@finestructure.net>
\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: Sat, 28 May 2011 21:52:34 -0000
\r
78 Again, this is a much cleaner and more thorough test, and in fact
\r
79 exposes a bug in the format=text output, that will be fixed the next
\r
80 commit. Because of this, some of the multipart tests currently fail.
\r
82 test/multipart | 189 ++++++++++++++++++++++++++++++++++++--------------------
\r
83 1 files changed, 121 insertions(+), 68 deletions(-)
\r
85 diff --git a/test/multipart b/test/multipart
\r
86 index 62efd84..6d194a5 100755
\r
87 --- a/test/multipart
\r
88 +++ b/test/multipart
\r
89 @@ -59,9 +59,9 @@ EOF
\r
90 notmuch new > /dev/null
\r
92 test_begin_subtest "--format=text --part=0, full message"
\r
93 -output=$(notmuch show --format=text --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
94 -test_expect_equal "$output" \
\r
96 message{ id:87liy5ap00.fsf@yoom.home.cworth.org depth:0 match:1 filename:${MAIL_DIR}/multipart
\r
97 +notmuch show --format=text --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
98 +cat <<EOF >EXPECTED
\r
100 message{ id:87liy5ap00.fsf@yoom.home.cworth.org depth:0 match:1 filename:${MAIL_DIR}/multipart
\r
103 Carl Worth <cworth@cworth.org> (2001-01-05) (attachment inbox signed unread)
\r
104 Subject: Multipart message
\r
105 @@ -92,12 +92,23 @@ Non-text part: application/pgp-signature
\r
117 +test_expect_equal_file OUTPUT EXPECTED
\r
119 -test_begin_subtest "--format=text --part=1, message body"
\r
120 -output=$(notmuch show --format=text --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
121 -test_expect_equal "$output" \
\r
123 part{ ID: 1, Content-type: multipart/signed
\r
124 +test_begin_subtest "--format=text --part=0, full message"
\r
125 +notmuch show --format=text --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
126 +cat <<EOF >EXPECTED
\r
128 message{ id:87liy5ap00.fsf@yoom.home.cworth.org depth:0 match:1 filename:${MAIL_DIR}/multipart
\r
131 +Carl Worth <cworth@cworth.org> (2001-01-05) (attachment inbox signed unread)
\r
132 +Subject: Multipart message
\r
133 +From: Carl Worth <cworth@cworth.org>
\r
134 +To: cworth@cworth.org
\r
135 +Date: Tue, 05 Jan 2001 15:43:57 -0000
\r
141 part{ ID: 1, Content-type: multipart/signed
\r
143 part{ ID: 2, Content-type: multipart/mixed
\r
145 part{ ID: 3, Content-type: message/rfc822
\r
147 part{ ID: 4, Content-type: text/html
\r
148 @@ -117,12 +128,16 @@ And this message is signed.
\r
150 part{ ID: 7, Content-type: application/pgp-signature
\r
151 Non-text part: application/pgp-signature
\r
163 +test_expect_equal_file OUTPUT EXPECTED
\r
165 test_begin_subtest "--format=text --part=2, multipart/mixed"
\r
166 -output=$(notmuch show --format=text --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
167 -test_expect_equal "$output" \
\r
169 part{ ID: 2, Content-type: multipart/mixed
\r
170 +notmuch show --format=text --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
171 +cat <<EOF >EXPECTED
\r
173 part{ ID: 2, Content-type: multipart/mixed
\r
175 part{ ID: 3, Content-type: message/rfc822
\r
177 part{ ID: 4, Content-type: text/html
\r
178 Non-text part: text/html
\r
179 @@ -137,47 +152,59 @@ And this message is signed.
\r
189 +test_expect_equal_file OUTPUT EXPECTED
\r
191 test_begin_subtest "--format=text --part=3, rfc822 multipart"
\r
192 -output=$(notmuch show --format=text --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
193 -test_expect_equal "$output" \
\r
195 part{ ID: 3, Content-type: message/rfc822
\r
196 +notmuch show --format=text --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
197 +cat <<EOF >EXPECTED
\r
199 part{ ID: 3, Content-type: message/rfc822
\r
201 part{ ID: 4, Content-type: text/html
\r
202 Non-text part: text/html
\r
210 +test_expect_equal_file OUTPUT EXPECTED
\r
212 test_begin_subtest "--format=text --part=4, html part"
\r
213 -output=$(notmuch show --format=text --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
214 -test_expect_equal "$output" \
\r
216 part{ ID: 4, Content-type: text/html
\r
217 +notmuch show --format=text --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
218 +cat <<EOF >EXPECTED
\r
220 part{ ID: 4, Content-type: text/html
\r
221 Non-text part: text/html
\r
227 +test_expect_equal_file OUTPUT EXPECTED
\r
229 test_begin_subtest "--format=text --part=5, inline attachement"
\r
230 -output=$(notmuch show --format=text --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
231 -test_expect_equal "$output" \
\r
233 attachment{ ID: 5, Content-type: text/plain
\r
234 +notmuch show --format=text --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
235 +cat <<EOF >EXPECTED
\r
237 attachment{ ID: 5, Content-type: text/plain
\r
238 Attachment: attachment (text/plain)
\r
239 This is a text attachment.
\r
245 +test_expect_equal_file OUTPUT EXPECTED
\r
247 test_begin_subtest "--format=text --part=6, plain text part"
\r
248 -output=$(notmuch show --format=text --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
249 -test_expect_equal "$output" \
\r
251 part{ ID: 6, Content-type: text/plain
\r
252 +notmuch show --format=text --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
253 +cat <<EOF >EXPECTED
\r
255 part{ ID: 6, Content-type: text/plain
\r
256 And this message is signed.
\r
264 +test_expect_equal_file OUTPUT EXPECTED
\r
266 test_begin_subtest "--format=text --part=7, pgp signature (unverified)"
\r
267 -output=$(notmuch show --format=text --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
268 -test_expect_equal "$output" \
\r
270 part{ ID: 7, Content-type: application/pgp-signature
\r
271 +notmuch show --format=text --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
272 +cat <<EOF >EXPECTED
\r
274 part{ ID: 7, Content-type: application/pgp-signature
\r
275 Non-text part: application/pgp-signature
\r
281 +test_expect_equal_file OUTPUT EXPECTED
\r
283 test_expect_success \
\r
284 "--format=text --part=8, no part, expect error" \
\r
285 @@ -197,11 +224,13 @@ test_begin_subtest "--format=json --part=2, multipart/mixed"
\r
286 output=$(notmuch show --format=json --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
287 test_expect_equal "$output" \
\r
288 '{"id": 2, "content-type": "multipart/mixed", "content": [{"id": 3, "content-type": "message/rfc822", "content": [{"id": 4, "content-type": "text/html"}]}, {"id": 5, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, {"id": 6, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}'
\r
289 +test_expect_equal_file OUTPUT EXPECTED
\r
291 test_begin_subtest "--format=json --part=3, rfc822 multipart"
\r
292 output=$(notmuch show --format=json --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
293 test_expect_equal "$output" \
\r
294 '{"id": 3, "content-type": "message/rfc822", "content": [{"id": 4, "content-type": "text/html"}]}'
\r
295 +test_expect_equal_file OUTPUT EXPECTED
\r
297 test_begin_subtest "--format=json --part=4, html part"
\r
298 output=$(notmuch show --format=json --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
299 @@ -228,17 +257,19 @@ test_expect_success \
\r
300 "notmuch show --format=json --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org'"
\r
302 test_begin_subtest "--format=raw"
\r
303 -output=$(notmuch show --format=raw 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
304 -test_expect_equal "$output" "$(cat "${MAIL_DIR}"/multipart)"
\r
305 +notmuch show --format=raw 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
306 +test_expect_equal_file OUTPUT "${MAIL_DIR}"/multipart
\r
308 test_begin_subtest "--format=raw --part=0, full message"
\r
309 -output=$(notmuch show --format=raw --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
310 -test_expect_equal "$output" "$(cat "${MAIL_DIR}"/multipart)"
\r
311 +notmuch show --format=raw --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
312 +test_expect_equal_file OUTPUT "${MAIL_DIR}"/multipart
\r
314 test_begin_subtest "--format=raw --part=1, message body"
\r
315 -output=$(notmuch show --format=raw --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
316 -test_expect_equal "$output" \
\r
317 -'<p>This is an imbeded message, with a single html part.</p>
\r
318 +notmuch show --format=raw --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
319 +# output should *not* include newline
\r
321 +cat <<EOF >EXPECTED
\r
322 +<p>This is an imbeded message, with a single html part.</p>
\r
323 This is a text attachment.
\r
324 And this message is signed.
\r
326 @@ -249,65 +280,86 @@ Version: GnuPG v1.4.11 (GNU/Linux)
\r
327 iEYEARECAAYFAk3SA/gACgkQ6JDdNq8qSWj0sACghqVJEQJUs3yV8zbTzhgnSIcD
\r
328 W6cAmQE4dcYrx/LPLtYLZm1jsGauE5hE
\r
330 ------END PGP SIGNATURE-----'
\r
331 +-----END PGP SIGNATURE-----
\r
333 +test_expect_equal_file OUTPUT EXPECTED
\r
335 test_begin_subtest "--format=raw --part=2, multipart/mixed"
\r
336 -output=$(notmuch show --format=raw --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
337 -test_expect_equal "$output" \
\r
338 -'<p>This is an imbeded message, with a single html part.</p>
\r
339 +notmuch show --format=raw --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
340 +cat <<EOF >EXPECTED
\r
341 +<p>This is an imbeded message, with a single html part.</p>
\r
342 This is a text attachment.
\r
343 And this message is signed.
\r
348 +test_expect_equal_file OUTPUT EXPECTED
\r
350 test_begin_subtest "--format=raw --part=3, rfc822 multipart"
\r
351 -output=$(notmuch show --format=raw --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
352 -test_expect_equal "$output" \
\r
353 -'<p>This is an imbeded message, with a single html part.</p>'
\r
354 +notmuch show --format=raw --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
355 +cat <<EOF >EXPECTED
\r
356 +<p>This is an imbeded message, with a single html part.</p>
\r
358 +test_expect_equal_file OUTPUT EXPECTED
\r
360 test_begin_subtest "--format=raw --part=4, html part"
\r
361 -output=$(notmuch show --format=raw --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
362 -test_expect_equal "$output" \
\r
363 -'<p>This is an imbeded message, with a single html part.</p>'
\r
364 +notmuch show --format=raw --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
365 +cat <<EOF >EXPECTED
\r
366 +<p>This is an imbeded message, with a single html part.</p>
\r
368 +test_expect_equal_file OUTPUT EXPECTED
\r
370 test_begin_subtest "--format=raw --part=5, inline attachment"
\r
371 -output=$(notmuch show --format=raw --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
372 -test_expect_equal "$output" \
\r
373 -'This is a text attachment.'
\r
374 +notmuch show --format=raw --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
375 +cat <<EOF >EXPECTED
\r
376 +This is a text attachment.
\r
378 +test_expect_equal_file OUTPUT EXPECTED
\r
380 test_begin_subtest "--format=raw --part=6, plain text part"
\r
381 -output=$(notmuch show --format=raw --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
382 -test_expect_equal "$output" \
\r
383 -'And this message is signed.
\r
384 +notmuch show --format=raw --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
385 +cat <<EOF >EXPECTED
\r
386 +And this message is signed.
\r
391 +test_expect_equal_file OUTPUT EXPECTED
\r
393 test_begin_subtest "--format=raw --part=7, pgp signature (unverified)"
\r
394 -output=$(notmuch show --format=raw --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
395 -test_expect_equal "$output" \
\r
396 -'-----BEGIN PGP SIGNATURE-----
\r
397 +notmuch show --format=raw --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
398 +# output should *not* include newline
\r
400 +cat <<EOF >EXPECTED
\r
401 +-----BEGIN PGP SIGNATURE-----
\r
402 Version: GnuPG v1.4.11 (GNU/Linux)
\r
404 iEYEARECAAYFAk3SA/gACgkQ6JDdNq8qSWj0sACghqVJEQJUs3yV8zbTzhgnSIcD
\r
405 W6cAmQE4dcYrx/LPLtYLZm1jsGauE5hE
\r
407 ------END PGP SIGNATURE-----'
\r
408 +-----END PGP SIGNATURE-----
\r
410 +test_expect_equal_file OUTPUT EXPECTED
\r
412 test_expect_success \
\r
413 "--format=raw --part=8, no part, expect error" \
\r
414 "notmuch show --format=raw --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org'"
\r
416 test_begin_subtest "--format=mbox"
\r
417 -output=$(notmuch show --format=mbox 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
418 -test_expect_equal "$output" "$(printf "From cworth@cworth.org Fri Jan 5 15:43:57 2001\n"; cat "${MAIL_DIR}"/multipart)"
\r
419 +notmuch show --format=mbox 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
420 +printf "From cworth@cworth.org Fri Jan 5 15:43:57 2001\n" >EXPECTED
\r
421 +cat "${MAIL_DIR}"/multipart >>EXPECTED
\r
422 +# mbox output is expected to include a blank line
\r
424 +test_expect_equal_file OUTPUT EXPECTED
\r
426 test_expect_success \
\r
427 "--format=mbox --part=1, incompatible, expect error" \
\r
428 "! notmuch show --format=mbox --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org'"
\r
430 test_begin_subtest "'notmuch reply' to a multipart message"
\r
431 -output=$(notmuch reply 'id:87liy5ap00.fsf@yoom.home.cworth.org')
\r
432 -test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
433 +notmuch reply 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
\r
434 +cat <<EOF >EXPECTED
\r
435 +From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
436 Subject: Re: Multipart message
\r
437 To: Carl Worth <cworth@cworth.org>, cworth@cworth.org
\r
438 In-Reply-To: <87liy5ap00.fsf@yoom.home.cworth.org>
\r
439 @@ -322,7 +374,8 @@ Non-text part: text/html
\r
440 > And this message is signed.
\r
443 -Non-text part: application/pgp-signature"
\r
445 +Non-text part: application/pgp-signature
\r
447 +test_expect_equal_file OUTPUT EXPECTED
\r