aboutsummaryrefslogtreecommitdiff
path: root/test/multipart
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2011-05-17 15:34:57 -0700
committerCarl Worth <cworth@cworth.org>2011-05-17 15:58:57 -0700
commit362ab047c264ae67ec3de041aec637979077db21 (patch)
treeb1a14c2f8a8434500b6d67c999570107c266a905 /test/multipart
parentc51d5b3cdb5ca0816816e88ca6f7136a24e74eee (diff)
notmuch show: Properly nest MIME parts within mulipart parts
Previously, notmuch show flattened all output, losing information about the nesting of the MIME hierarchy. Now, the output is properly nested, (both in the --format=text and --format=json output), so that clients can analyze the original MIME structure. Internally, this required splitting the final closing delimiter out of the various show_part functions and putting it into a new show_part_end function instead. Also, the show_part function now accepts a new "first" argument that is set not only for the first MIME part of a message, but also for each first MIME part within a series of multipart parts. This "first" argument controls the omission of a preceding comma when printing a part (for json). Many thanks to David Edmondson <dme@dme.org> for originally identifying the lack of nesting in the json output and submitting an early implementation of this feature. Thanks as well to Jameson Graef Rollins <jrollins@finestructure.net> for carefully shepherding David's patches through a remarkably long review process, patiently explaining them, and providing a cleaned up series that led to this final implementation. Jameson also provided the new emacs code here.
Diffstat (limited to 'test/multipart')
-rwxr-xr-xtest/multipart6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/multipart b/test/multipart
index ef9a8a2..fd59b60 100755
--- a/test/multipart
+++ b/test/multipart
@@ -59,9 +59,7 @@ Date: Tue, 05 Jan 2001 15:43:57 -0000
header}
body{
part{ ID: 1, Content-type: multipart/signed
- part}
part{ ID: 2, Content-type: multipart/mixed
- part}
part{ ID: 3, Content-type: text/plain
This is an inline text part.
part}
@@ -74,15 +72,17 @@ And this message is signed.
-Carl
part}
+ part}
part{ ID: 6, Content-type: application/pgp-signature
Non-text part: application/pgp-signature
part}
+ part}
body}
message}"
test_begin_subtest "Show multipart MIME message (--format=json)"
output=$(notmuch show --format=json 'id:87liy5ap00.fsf@yoom.home.cworth.org')
-test_expect_equal "$output" '[[[{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "/home/cworth/src/notmuch/test/tmp.multipart/mail/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Cc": "", "Bcc": "", "Date": "Tue, 05 Jan 2001 15:43:57 -0000"}, "body": [{"id": 1, "content-type": "multipart/signed"}, {"id": 2, "content-type": "multipart/mixed"}, {"id": 3, "content-type": "text/plain", "content": "This is an inline text part.\n"}, {"id": 4, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, {"id": 5, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}, {"id": 6, "content-type": "application/pgp-signature"}]}, []]]]'
+test_expect_equal "$output" '[[[{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "/home/cworth/src/notmuch/test/tmp.multipart/mail/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Cc": "", "Bcc": "", "Date": "Tue, 05 Jan 2001 15:43:57 -0000"}, "body": [{"id": 1, "content-type": "multipart/signed", "content": [{"id": 2, "content-type": "multipart/mixed", "content": [{"id": 3, "content-type": "text/plain", "content": "This is an inline text part.\n"}, {"id": 4, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, {"id": 5, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, {"id": 6, "content-type": "application/pgp-signature"}]}]}, []]]]'
test_done