Re: [PATCH v3 4/5] Adding tests for --format=sexp.
authorMark Walters <markwalters1009@gmail.com>
Thu, 6 Dec 2012 08:18:28 +0000 (08:18 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:51:34 +0000 (09:51 -0800)
99/e0525d9bfbf8af0a9b618b81ab8bdb08978176 [new file with mode: 0644]

diff --git a/99/e0525d9bfbf8af0a9b618b81ab8bdb08978176 b/99/e0525d9bfbf8af0a9b618b81ab8bdb08978176
new file mode 100644 (file)
index 0000000..c1ed046
--- /dev/null
@@ -0,0 +1,223 @@
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 82766431FB6\r
+       for <notmuch@notmuchmail.org>; Thu,  6 Dec 2012 00:18:32 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+       tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+       NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id JMws9JjzeCnn for <notmuch@notmuchmail.org>;\r
+       Thu,  6 Dec 2012 00:18:30 -0800 (PST)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 7F82F431FAE\r
+       for <notmuch@notmuchmail.org>; Thu,  6 Dec 2012 00:18:30 -0800 (PST)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+       by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+       (envelope-from <m.walters@qmul.ac.uk>)\r
+       id 1TgWf2-0002IT-FD; Thu, 06 Dec 2012 08:18:26 +0000\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+       by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
+       (envelope-from <m.walters@qmul.ac.uk>)\r
+       id 1TgWf1-0007XD-UF; Thu, 06 Dec 2012 08:18:24 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Peter Feigl <craven@gmx.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v3 4/5] Adding tests for --format=sexp.\r
+In-Reply-To: <1354779189-12231-5-git-send-email-craven@gmx.net>\r
+References: <1354779189-12231-1-git-send-email-craven@gmx.net>\r
+       <1354779189-12231-5-git-send-email-craven@gmx.net>\r
+User-Agent: Notmuch/0.14+81~g9730584 (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Thu, 06 Dec 2012 08:18:28 +0000\r
+Message-ID: <87y5hbpp9n.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-SPAM-Info: Sender has good ham record.  :)\r
+X-QM-Body-MD5: c56bcfe8ec65f4411b0c2760051ad77a (of first 20000 bytes)\r
+X-SpamAssassin-Score: -1.7\r
+X-SpamAssassin-SpamBar: -\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+       determine if it is\r
+       spam. We require at least 5.0 points to mark a message as spam.\r
+       This message scored -1.7 points.\r
+       Summary of the scoring: \r
+       * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
+       *      medium trust\r
+       *      [138.37.6.40 listed in list.dnswl.org]\r
+       * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+       provider *      (markwalters1009[at]gmail.com)\r
+       *  0.6 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 06 Dec 2012 08:18:32 -0000\r
+\r
+On Thu, 06 Dec 2012, Peter Feigl <craven@gmx.net> wrote:\r
+> Add basic tests, the same as for json, for the S-Expression output\r
+> format.\r
+> ---\r
+>  test/notmuch-test |  1 +\r
+>  test/sexp         | 48 ++++++++++++++++++++++++++++++++++++++++++++++++\r
+>  2 files changed, 49 insertions(+)\r
+>  create mode 100755 test/sexp\r
+>\r
+> diff --git a/test/notmuch-test b/test/notmuch-test\r
+> index a6ef34f..ca9c3dc 100755\r
+> --- a/test/notmuch-test\r
+> +++ b/test/notmuch-test\r
+> @@ -31,6 +31,7 @@ TESTS=3D"\r
+>    excludes\r
+>    tagging\r
+>    json\r
+> +  sexp\r
+>    text\r
+>    multipart\r
+>    thread-naming\r
+> diff --git a/test/sexp b/test/sexp\r
+> new file mode 100755\r
+> index 0000000..335844e\r
+> --- /dev/null\r
+> +++ b/test/sexp\r
+> @@ -0,0 +1,48 @@\r
+> +#!/usr/bin/env bash\r
+> +test_description=3D"--format=3Dsexp output"\r
+> +. ./test-lib.sh\r
+> +\r
+> +test_begin_subtest "Show message: sexp"\r
+> +add_message "[subject]=3D\"sexp-show-subject\"" "[date]=3D\"Sat, 01 Jan =\r
+2000 12:00:00 -0000\"" "[bcc]=3D\"test_suite+bcc@notmuchmail.org\"" "[reply=\r
+-to]=3D\"test_suite+replyto@notmuchmail.org\"" "[body]=3D\"sexp-show-messag=\r
+e\""\r
+> +output=3D$(notmuch show --format=3Dsexp "sexp-show-message")\r
+> +test_expect_equal "$output" "((((:id \"msg-001@notmuch-test-suite\" :mat=\r
+ch t :excluded nil :filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail/ms=\r
+g-001\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\"=\r
+ \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test =\r
+Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@n=\r
+otmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_=\r
+suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") =\r
+:body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"=\r
+))) ())))"\r
+\r
+The :filename above is hardcoded (so will fail for most of us). I know\r
+there are some variables/functions for things like that but I am not\r
+sure exactly which bits need to be wrapped. I think message-id and\r
+thread-id are often a problem too.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+> +\r
+> +# This should be the same output as above.\r
+> +test_begin_subtest "Show message: sexp --body=3Dtrue"\r
+> +output=3D$(notmuch show --format=3Dsexp --body=3Dtrue "sexp-show-message=\r
+")\r
+> +test_expect_equal "$output" "((((:id \"msg-001@notmuch-test-suite\" :mat=\r
+ch t :excluded nil :filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail/ms=\r
+g-001\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\"=\r
+ \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test =\r
+Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@n=\r
+otmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_=\r
+suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") =\r
+:body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"=\r
+))) ())))"\r
+> +\r
+> +test_begin_subtest "Show message: sexp --body=3Dfalse"\r
+> +output=3D$(notmuch show --format=3Dsexp --body=3Dfalse "sexp-show-messag=\r
+e")\r
+> +test_expect_equal "$output" "((((:id \"msg-001@notmuch-test-suite\" :mat=\r
+ch t :excluded nil :filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail/ms=\r
+g-001\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\"=\r
+ \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test =\r
+Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@n=\r
+otmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_=\r
+suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\"))=\r
+ ())))"\r
+> +\r
+> +test_begin_subtest "Search message: sexp"\r
+> +add_message "[subject]=3D\"sexp-search-subject\"" "[date]=3D\"Sat, 01 Ja=\r
+n 2000 12:00:00 -0000\"" "[body]=3D\"sexp-search-message\""\r
+> +output=3D$(notmuch search --format=3Dsexp "sexp-search-message" | notmuc=\r
+h_search_sanitize)\r
+> +test_expect_equal "$output" "((:thread \"0000000000000002\" :timestamp 9=\r
+46728000 :date_relative \"2000-01-01\" :matched 1 :total 1 :authors \"Notmu=\r
+ch Test Suite\" :subject \"sexp-search-subject\" :tags (\"inbox\" \"unread\=\r
+")))"\r
+> +\r
+> +test_begin_subtest "Show message: sexp, utf-8"\r
+> +add_message "[subject]=3D\"sexp-show-utf8-body-s=C3=BCbj=C3=A9ct\"" "[da=\r
+te]=3D\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=3D\"js=C3=B6n-show-m=C3=\r
+=A9ssage\""\r
+> +output=3D$(notmuch show --format=3Dsexp "js=C3=B6n-show-m=C3=A9ssage")\r
+> +test_expect_equal "$output" "((((:id \"msg-003@notmuch-test-suite\" :mat=\r
+ch t :excluded nil :filename \"/home/nex/notmuch-sexp/test/tmp.sexp/mail/ms=\r
+g-003\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\"=\r
+ \"unread\") :headers (:Subject \"sexp-show-utf8-body-s=C3=BCbj=C3=A9ct\" :=\r
+>From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test=\r
+ Suite <test_suite@notmuchmail.org>\" :Date \"Sat, 01 Jan 2000 12:00:00 +00=\r
+00\") :body ((:id 1 :content-type \"text/plain\" :content \"js=C3=B6n-show-=\r
+m=C3=A9ssage\n\"))) ())))"\r
+> +\r
+> +test_begin_subtest "Show message: sexp, inline attachment filename"\r
+> +subject=3D'sexp-show-inline-attachment-filename'\r
+> +id=3D"sexp-show-inline-attachment-filename@notmuchmail.org"\r
+> +emacs_deliver_message \\r
+> +    "$subject" \\r
+> +    'This is a test message with inline attachment with a filename' \\r
+> +    "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\")\r
+> +     (message-goto-eoh)\r
+> +     (insert \"Message-ID: <$id>\n\")"\r
+> +output=3D$(notmuch show --format=3Dsexp "id:$id")\r
+> +filename=3D$(notmuch search --output=3Dfiles "id:$id")\r
+> +test_expect_equal "$output" "((((:id \"sexp-show-inline-attachment-filen=\r
+ame@notmuchmail.org\" :match t :excluded nil :filename \"$filename\" :times=\r
+tamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\") :headers (:S=\r
+ubject \"sexp-show-inline-attachment-filename\" :From \"Notmuch Test Suite =\r
+<test_suite@notmuchmail.org>\" :To \"test_suite@notmuchmail.org\" :Date \"S=\r
+at, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"multipart/m=\r
+ixed\" :content ((:id 2 :content-type \"text/plain\" :content \"This is a t=\r
+est message with inline attachment with a filename\") (:id 3 :content-type =\r
+\"application/octet-stream\" :filename \"README\"))))) ())))"\r
+> +\r
+> +test_begin_subtest "Search message: sexp, utf-8"\r
+> +add_message "[subject]=3D\"sexp-search-utf8-body-s=C3=BCbj=C3=A9ct\"" "[=\r
+date]=3D\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=3D\"js=C3=B6n-search-m=\r
+=C3=A9ssage\""\r
+> +output=3D$(notmuch search --format=3Dsexp "js=C3=B6n-search-m=C3=A9ssage=\r
+" | notmuch_search_sanitize)\r
+> +test_expect_equal "$output" "((:thread \"0000000000000005\" :timestamp 9=\r
+46728000 :date_relative \"2000-01-01\" :matched 1 :total 1 :authors \"Notmu=\r
+ch Test Suite\" :subject \"sexp-search-utf8-body-s=C3=BCbj=C3=A9ct\" :tags =\r
+(\"inbox\" \"unread\")))"\r
+> +\r
+> +\r
+> +test_done\r
+> --=20\r
+> 1.8.0\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r