[PATCH 1/2] test: add emacs show mode test for toggling display of multipart/alternative

Jameson Graef Rollins jrollins at finestructure.net
Sun Aug 12 10:39:27 PDT 2012


Fairly simple test that looks at a diff of test-emacs output from each
case.
---
As I mentioned, I really like this toggle view solution, so here's a
test for it.

 test/emacs-show |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/test/emacs-show b/test/emacs-show
index e9a714f..695f929 100755
--- a/test/emacs-show
+++ b/test/emacs-show
@@ -36,4 +36,51 @@ test_begin_subtest "Bare subject #3"
 output=$(test_emacs '(notmuch-show-strip-re "the cure: fix the regexp")')
 test_expect_equal "$output" '"the cure: fix the regexp"'
 
+test_begin_subtest "Toggle display multipart/alternative"
+cat <<EOF > ${MAIL_DIR}/embedded_message
+From: Carl Worth <cworth at cworth.org>
+To: cworth at cworth.org
+Subject: html message
+Date: Fri, 05 Jan 2001 15:42:57 +0000
+User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu)
+Message-ID: <87liy5ap01.fsf at yoom.home.cworth.org>
+MIME-Version: 1.0
+Content-Type: multipart/alternative; boundary="==-=-=="
+
+--==-=-==
+Content-Type: text/html
+
+<p>This is the text/html part of a multipart/alternative.</p>
+
+--==-=-==
+Content-Type: text/plain
+
+This is the text/plain part of a multipart/alternative.
+
+--==-=-==--
+EOF
+notmuch new > /dev/null
+test_emacs "(let ((notmuch-show-all-multipart/alternative-parts nil))
+              (notmuch-show \"id:87liy5ap01.fsf at yoom.home.cworth.org\")
+	      (test-output))"
+mv OUTPUT{,.text}
+test_emacs "(let ((notmuch-show-all-multipart/alternative-parts nil))
+              (notmuch-show \"id:87liy5ap01.fsf at yoom.home.cworth.org\")
+              (notmuch-show-cycle-message-multipart)
+	      (test-output))"
+mv OUTPUT{,.html}
+diff OUTPUT.{text,html} >OUTPUT.diff
+cat <<EOF >EXPECTED.diff
+7,9c7,10
+< [ text/html (not shown) ]
+< [ text/plain ]
+< This is the text/plain part of a multipart/alternative.
+---
+> [ text/html ]
+> This is the text/html part of a multipart/alternative.
+> 
+> [ text/plain (not shown) ]
+EOF
+test_expect_equal_file {OUTPUT,EXPECTED}.diff
+
 test_done
-- 
1.7.10.4



More information about the notmuch mailing list