[PATCH v4 4/5] Adding tests for --format=sexp.
authorPeter Feigl <craven@gmx.net>
Thu, 6 Dec 2012 11:44:58 +0000 (12:44 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:51:35 +0000 (09:51 -0800)
77/6e5c38cca619340f24769a0b42504682910917 [new file with mode: 0644]

diff --git a/77/6e5c38cca619340f24769a0b42504682910917 b/77/6e5c38cca619340f24769a0b42504682910917
new file mode 100644 (file)
index 0000000..1bf1a40
--- /dev/null
@@ -0,0 +1,129 @@
+Return-Path: <nex@nexoid.at>\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 B0BEE431FD4\r
+       for <notmuch@notmuchmail.org>; Thu,  6 Dec 2012 03:45:28 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.001\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.001 tagged_above=-999 required=5\r
+       tests=[FREEMAIL_FROM=0.001] 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 j4s9hC8MXK58 for <notmuch@notmuchmail.org>;\r
+       Thu,  6 Dec 2012 03:45:26 -0800 (PST)\r
+Received: from mail.nexoid.at (www.nexoid.at [178.79.130.240])\r
+       (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id ADD26431FC3\r
+       for <notmuch@notmuchmail.org>; Thu,  6 Dec 2012 03:45:21 -0800 (PST)\r
+Received: by mail.nexoid.at (Postfix, from userid 1000)\r
+       id 4FCB411C110; Thu,  6 Dec 2012 12:45:14 +0100 (CET)\r
+From: Peter Feigl <craven@gmx.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 4/5] Adding tests for --format=sexp.\r
+Date: Thu,  6 Dec 2012 12:44:58 +0100\r
+Message-Id:\r
+ <2e05638af4ddc1f93f8b4fc5dde7c5d2fde8cda6.1354794428.git.craven@gmx.net>\r
+X-Mailer: git-send-email 1.8.0\r
+In-Reply-To: <cover.1354794428.git.craven@gmx.net>\r
+References: <cover.1354794428.git.craven@gmx.net>\r
+In-Reply-To: <cover.1354794428.git.craven@gmx.net>\r
+References: <cover.1354794428.git.craven@gmx.net>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\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 11:45:29 -0000\r
+\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="\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..b804942\r
+--- /dev/null\r
++++ b/test/sexp\r
+@@ -0,0 +1,48 @@\r
++#!/usr/bin/env bash\r
++test_description="--format=sexp output"\r
++. ./test-lib.sh\r
++\r
++test_begin_subtest "Show message: sexp"\r
++add_message "[subject]=\"sexp-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[reply-to]=\"test_suite+replyto@notmuchmail.org\"" "[body]=\"sexp-show-message\""\r
++output=$(notmuch show --format=sexp "sexp-show-message")\r
++test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))"\r
++\r
++# This should be the same output as above.\r
++test_begin_subtest "Show message: sexp --body=true"\r
++output=$(notmuch show --format=sexp --body=true "sexp-show-message")\r
++test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"sexp-show-message\n\"))) ())))"\r
++\r
++test_begin_subtest "Show message: sexp --body=false"\r
++output=$(notmuch show --format=sexp --body=false "sexp-show-message")\r
++test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-subject\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Bcc \"test_suite+bcc@notmuchmail.org\" :Reply-To \"test_suite+replyto@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\")) ())))"\r
++\r
++test_begin_subtest "Search message: sexp"\r
++add_message "[subject]=\"sexp-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"sexp-search-message\""\r
++output=$(notmuch search --format=sexp "sexp-search-message" | notmuch_search_sanitize)\r
++test_expect_equal "$output" "((:thread \"0000000000000002\" :timestamp 946728000 :date_relative \"2000-01-01\" :matched 1 :total 1 :authors \"Notmuch Test Suite\" :subject \"sexp-search-subject\" :tags (\"inbox\" \"unread\")))"\r
++\r
++test_begin_subtest "Show message: sexp, utf-8"\r
++add_message "[subject]=\"sexp-show-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-show-méssage\""\r
++output=$(notmuch show --format=sexp "jsön-show-méssage")\r
++test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :filename \"${gen_msg_filename}\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\" \"unread\") :headers (:Subject \"sexp-show-utf8-body-sübjéct\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"text/plain\" :content \"jsön-show-méssage\n\"))) ())))"\r
++\r
++test_begin_subtest "Show message: sexp, inline attachment filename"\r
++subject='sexp-show-inline-attachment-filename'\r
++id="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=$(notmuch show --format=sexp "id:$id")\r
++filename=$(notmuch search --output=files "id:$id")\r
++test_expect_equal "$output" "((((:id \"$id\" :match t :excluded nil :filename \"$filename\" :timestamp 946728000 :date_relative \"2000-01-01\" :tags (\"inbox\") :headers (:Subject \"sexp-show-inline-attachment-filename\" :From \"Notmuch Test Suite <test_suite@notmuchmail.org>\" :To \"test_suite@notmuchmail.org\" :Date \"Sat, 01 Jan 2000 12:00:00 +0000\") :body ((:id 1 :content-type \"multipart/mixed\" :content ((:id 2 :content-type \"text/plain\" :content \"This is a test message with inline attachment with a filename\") (:id 3 :content-type \"application/octet-stream\" :filename \"README\"))))) ())))"\r
++\r
++test_begin_subtest "Search message: sexp, utf-8"\r
++add_message "[subject]=\"sexp-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\""\r
++output=$(notmuch search --format=sexp "jsön-search-méssage" | notmuch_search_sanitize)\r
++test_expect_equal "$output" "((:thread \"0000000000000005\" :timestamp 946728000 :date_relative \"2000-01-01\" :matched 1 :total 1 :authors \"Notmuch Test Suite\" :subject \"sexp-search-utf8-body-sübjéct\" :tags (\"inbox\" \"unread\")))"\r
++\r
++\r
++test_done\r
+-- \r
+1.8.0\r
+\r