Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 4992B429E30 for ; Sat, 24 Aug 2013 14:36:20 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.098 X-Spam-Level: X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fFE2pZvNGcpk for ; Sat, 24 Aug 2013 14:36:12 -0700 (PDT) Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 0B5D4429E2E for ; Sat, 24 Aug 2013 14:36:12 -0700 (PDT) Received: from smtp.qmul.ac.uk ([138.37.6.40]) by mail2.qmul.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1VDLV6-0002zN-0o; Sat, 24 Aug 2013 22:36:06 +0100 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) (envelope-from ) id 1VDLV5-0008Qc-MR; Sat, 24 Aug 2013 22:36:03 +0100 From: Mark Walters To: Tomi Ollila , notmuch@notmuchmail.org Subject: Re: [PATCH 1/1] test: test notmuch show --include-html option In-Reply-To: <1377358170-20561-1-git-send-email-tomi.ollila@iki.fi> References: <1377358170-20561-1-git-send-email-tomi.ollila@iki.fi> User-Agent: Notmuch/0.15.2+269~g01f5508 (http://notmuchmail.org) Emacs/23.4.1 (i486-pc-linux-gnu) Date: Sat, 24 Aug 2013 22:36:02 +0100 Message-ID: <877gfa93gd.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Host-Address: 93.97.24.31 X-QM-SPAM-Info: Sender has good ham record. :) X-QM-Body-MD5: 7d251aa7bbcf5c7e6d64c69d540f9654 (of first 20000 bytes) X-SpamAssassin-Score: 0.0 X-SpamAssassin-SpamBar: / X-SpamAssassin-Report: The QM spam filters have analysed this message to determine if it is spam. We require at least 5.0 points to mark a message as spam. This message scored 0.0 points. Summary of the scoring: * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * 0.0 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean Cc: tomi.ollila@iki.fi X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2013 21:36:20 -0000 Hi Thanks for this. The pair of patches id:notmuch-web-1372724382.450184839@www.wuzzeb.org and id:1377358170-20561-1-git-send-email-tomi.ollila@iki.fi LGTM +1 Best wishes Mark Tomi Ollila writes: > Test new --include-html option added to notmuch show command with > json output message parts containing text in latin1 and utf8 format. > --- > > this is test for id:notmuch-web-1372724382.450184839@www.wuzzeb.org asked > by Mark in id:87txifzexo.fsf@qmul.ac.uk > > test/multipart | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 81 insertions(+), 1 deletion(-) > > diff --git a/test/multipart b/test/multipart > index 2033023..b40fa2c 100755 > --- a/test/multipart > +++ b/test/multipart > @@ -647,4 +647,84 @@ notmuch show --format=raw --part=3 id:base64-part-with-crlf > crlf.out > echo -n -e "\xEF\x0D\x0A" > crlf.expected > test_expect_equal_file crlf.out crlf.expected > > -test_done > \ No newline at end of file > + > +# The ISO-8859-1 encoding of U+00BD is a single byte: octal 275 > +# (Portability note: Dollar-Single ($'...', ANSI C-style escape sequences) > +# quoting works on bash, ksh, zsh, *BSD sh but not on dash, ash nor busybox sh) > +readonly u_00bd_latin1=$'\275' > + > +# The Unicode fraction symbol 1/2 is U+00BD and is encoded > +# in UTF-8 as two bytes: octal 302 275 > +readonly u_00bd_utf8=$'\302\275' > + > +cat < ${MAIL_DIR}/include-html > +From: A > +To: B > +Subject: html message > +Date: Sat, 01 January 2000 00:00:00 +0000 > +Message-ID: > +MIME-Version: 1.0 > +Content-Type: multipart/alternative; boundary="==-==" > + > +--==-== > +Content-Type: text/html; charset=UTF-8 > + > +

0.5 equals ${u_00bd_utf8}

> + > +--==-== > +Content-Type: text/html; charset=ISO-8859-1 > + > +

0.5 equals ${u_00bd_latin1}

> + > +--==-== > +Content-Type: text/plain; charset=UTF-8 > + > +0.5 equals ${u_00bd_utf8} > + > +--==-==-- > +EOF > + > +notmuch new > /dev/null > + > +cat_expected_head () > +{ > + cat < +[[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01", > + "timestamp": 946684800, > + "filename": "${MAIL_DIR}/include-html", > + "tags": ["inbox", "unread"], > + "headers": { "Date": "Sat, 01 Jan 2000 00:00:00 +0000", "From": "A ", > + "Subject": "html message", "To": "B "}, > + "body": [{ > + "content-type": "multipart/alternative", "id": 1, > +EOF > +} > + > +cat_expected_head > EXPECTED.nohtml > +cat <> EXPECTED.nohtml > +"content": [ > + { "id": 2, "content-charset": "UTF-8", "content-length": 21, "content-type": "text/html"}, > + { "id": 3, "content-charset": "ISO-8859-1", "content-length": 20, "content-type": "text/html"}, > + { "id": 4, "content-type": "text/plain", "content": "0.5 equals \\u00bd\\n"} > +]}]},[]]]] > +EOF > + > +# Both the UTF-8 and ISO-8859-1 part should have U+00BD > +cat_expected_head > EXPECTED.withhtml > +cat <> EXPECTED.withhtml > +"content": [ > + { "id": 2, "content-type": "text/html", "content": "

0.5 equals \\u00bd

\\n"}, > + { "id": 3, "content-type": "text/html", "content": "

0.5 equals \\u00bd

\\n"}, > + { "id": 4, "content-type": "text/plain", "content": "0.5 equals \\u00bd\\n"} > +]}]},[]]]] > +EOF > + > +test_begin_subtest "html parts excluded by default" > +notmuch show --format=json id:htmlmessage > OUTPUT > +test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.nohtml)" > + > +test_begin_subtest "html parts included" > +notmuch show --format=json --include-html id:htmlmessage > OUTPUT > +test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)" > + > +test_done > -- > 1.8.0 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch