[PATCH] contrib: notmuch-pick: add tests
authorMark Walters <markwalters1009@gmail.com>
Mon, 29 Oct 2012 08:37:36 +0000 (08:37 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:50:09 +0000 (09:50 -0800)
19/b05967770ecea6cd3672737b08143ff98ade85 [new file with mode: 0644]

diff --git a/19/b05967770ecea6cd3672737b08143ff98ade85 b/19/b05967770ecea6cd3672737b08143ff98ade85
new file mode 100644 (file)
index 0000000..7a70356
--- /dev/null
@@ -0,0 +1,314 @@
+Return-Path: <markwalters1009@gmail.com>\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 9E965431FBC\r
+       for <notmuch@notmuchmail.org>; Mon, 29 Oct 2012 01:37:51 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] 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 ORRS2qa8qnmF for <notmuch@notmuchmail.org>;\r
+       Mon, 29 Oct 2012 01:37:47 -0700 (PDT)\r
+Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com\r
+ [74.125.82.45])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ 48B25431FAF   for <notmuch@notmuchmail.org>; Mon, 29 Oct 2012 01:37:47 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f45.google.com with SMTP id dq12so2960579wgb.2\r
+       for <notmuch@notmuchmail.org>; Mon, 29 Oct 2012 01:37:44 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:mime-version\r
+       :content-type:content-transfer-encoding;\r
+       bh=zNSM7C/DY8PdySu0PkT1uHnudyfT3n6xV3HaOzoNEaM=;\r
+       b=DB6lOD8ByQOSYaaUXZfldtWEM30bz/ILA4pUwp8qPGuCR7m+wRiMMrLsOOcq1uzWc+\r
+       RZH3cX9XtvcBT/EtML5Tw3fCX1W7iqLsDkTd2Qp/wzkvUQU58BFtN/9ehP0fFTSQrzYl\r
+       ocNQTf1tXFBHqnUyzTa187yWY0RJU4Xe8gFfc4Pz5XW5FkYQLUvThYCfptv0hAkNf7/E\r
+       MJW3m7CMzcuDS3bU0R6NwKTQcG5fmxiteGiQGONWaDnLwBlZJL6zHQqdiZwDyRSbm70X\r
+       Xy6fIbukDv09QxajoHY/mSrYWJ8x3AxXDvz7vxs0EfdkkzJlWLh7GVAtZSgXIlyNI7uM\r
+       /Slg==\r
+Received: by 10.180.94.102 with SMTP id db6mr13846274wib.20.1351499864517;\r
+       Mon, 29 Oct 2012 01:37:44 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+       by mx.google.com with ESMTPS id gm7sm10249555wib.10.2012.10.29.01.37.42\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Mon, 29 Oct 2012 01:37:43 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: =?UTF-8?q?=5BPATCH=5D=20contrib=3A=20notmuch-pick=3A=20add=20tests?=\r
+Date: Mon, 29 Oct 2012 08:37:36 +0000\r
+Message-Id: <1351499856-14136-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\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: Mon, 29 Oct 2012 08:37:51 -0000\r
+\r
+The test should be run using the wrapper test-wrapper.sh.  This links\r
+the tests into the normal notmuch TEST_DIRECTORY and runs them from\r
+there. After the test is complete then the links are removed.\r
+---\r
+\r
+Here are some tests for notmuch-pick. I would have liked to include\r
+the test structure and run them from inside the pick contrib directory\r
+but I couldn't get all the paths to work.\r
+\r
+Hence, this slightly hacky solution of linking the relevant stuff (one\r
+test script and one expected output directory) into the normal notmuch\r
+test directory and running from there.                     \r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+ contrib/notmuch-pick/README                        |    5 +\r
+ contrib/notmuch-pick/test-wrapper.sh               |   16 +++\r
+ contrib/notmuch-pick/test/emacs-pick               |  104 ++++++++++++++++++++\r
+ .../notmuch-pick-single-thread                     |    6 +\r
+ .../pick.expected-output/notmuch-pick-tag-inbox    |   53 ++++++++++\r
+ 5 files changed, 184 insertions(+), 0 deletions(-)\r
+ create mode 100755 contrib/notmuch-pick/test-wrapper.sh\r
+ create mode 100755 contrib/notmuch-pick/test/emacs-pick\r
+ create mode 100644 contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-single-thread\r
+ create mode 100644 contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-tag-inbox\r
+\r
+diff --git a/contrib/notmuch-pick/README b/contrib/notmuch-pick/README\r
+index 8eed974..98251f6 100644\r
+--- a/contrib/notmuch-pick/README\r
++++ b/contrib/notmuch-pick/README\r
+@@ -15,6 +15,11 @@ Then after the "(require 'notmuch)" line in your .emacs file add\r
+ the line "(require 'notmuch-pick nil t)". This will load notmuch-pick on\r
+ your next emacs start.\r
\r
++TEST\r
++\r
++Just execute test-wrapper.sh from this directory and it should all\r
++work. It does require that notmuch has already been built.\r
++\r
+ USING PICK\r
\r
+ The main key entries to notmuch pick are\r
+diff --git a/contrib/notmuch-pick/test-wrapper.sh b/contrib/notmuch-pick/test-wrapper.sh\r
+new file mode 100755\r
+index 0000000..3ecf5b9\r
+--- /dev/null\r
++++ b/contrib/notmuch-pick/test-wrapper.sh\r
+@@ -0,0 +1,16 @@\r
++#!/usr/bin/env bash\r
++\r
++fail() {\r
++    echo ERROR $1\r
++    exit 1\r
++}\r
++\r
++export PICK_DIR=$PWD\r
++ln -s $PWD/test/emacs-pick ../../test/ || fail "emacs pick test exists"\r
++ln -s $PWD/test/pick.expected-output ../../test/ || fail "pick.expected-output exists"\r
++\r
++cd ../../test || fail "Cannot find test directory"\r
++./emacs-pick\r
++\r
++rm emacs-pick\r
++rm pick.expected-output\r
+diff --git a/contrib/notmuch-pick/test/emacs-pick b/contrib/notmuch-pick/test/emacs-pick\r
+new file mode 100755\r
+index 0000000..9478732\r
+--- /dev/null\r
++++ b/contrib/notmuch-pick/test/emacs-pick\r
+@@ -0,0 +1,104 @@\r
++#!/usr/bin/env bash\r
++\r
++test_description="emacs interface"\r
++. test-lib.sh\r
++\r
++EXPECTED=$TEST_DIRECTORY/pick.expected-output\r
++\r
++add_email_corpus\r
++test_begin_subtest "Do we have emacs"\r
++test_emacs '(insert "hello\n")\r
++            (test-output)'\r
++cat <<EOF >EXPECTED\r
++hello\r
++EOF\r
++test_expect_equal_file OUTPUT EXPECTED\r
++\r
++test_begin_subtest "Basic notmuch-pick view in emacs"\r
++test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")\r
++            (require (quote notmuch-pick))\r
++            (notmuch-pick "tag:inbox")\r
++            (notmuch-test-wait)\r
++            (test-output)'\r
++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox\r
++\r
++test_begin_subtest "Basic notmuch-pick view in emacs (sync)"\r
++test_emacs '(setq notmuch-pick-asynchronous-parser nil)\r
++            (notmuch-pick "tag:inbox")\r
++            (notmuch-test-wait)\r
++            (test-output)'\r
++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox\r
++\r
++test_begin_subtest "Navigation of notmuch-hello to search results"\r
++test_emacs '(notmuch-hello)\r
++            (goto-char (point-min))\r
++            (re-search-forward "inbox")\r
++            (widget-button-press (1- (point)))\r
++            (notmuch-test-wait)\r
++          (notmuch-pick-from-search-current-query)\r
++            (notmuch-test-wait)\r
++            (test-output)'\r
++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox\r
++\r
++test_begin_subtest "Navigation of notmuch-hello to search results (sync)"\r
++test_emacs '(setq notmuch-pick-asynchronous-parser nil)\r
++            (notmuch-hello)\r
++            (goto-char (point-min))\r
++            (re-search-forward "inbox")\r
++            (widget-button-press (1- (point)))\r
++            (notmuch-test-wait)\r
++          (notmuch-pick-from-search-current-query)\r
++            (notmuch-test-wait)\r
++            (test-output)'\r
++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox\r
++\r
++test_begin_subtest "Pick of a single thread (from search)"\r
++test_emacs '(notmuch-hello)\r
++            (goto-char (point-min))\r
++            (re-search-forward "inbox")\r
++            (widget-button-press (1- (point)))\r
++            (notmuch-test-wait)\r
++            (notmuch-pick-from-search-thread)\r
++            (notmuch-test-wait)\r
++            (test-output)'\r
++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread\r
++\r
++test_begin_subtest "Pick of a single thread (sync from search)"\r
++test_emacs '(delete-other-windows)\r
++            (setq notmuch-pick-asynchronous-parser nil)\r
++            (notmuch-hello)\r
++            (goto-char (point-min))\r
++            (re-search-forward "inbox")\r
++            (widget-button-press (1- (point)))\r
++            (notmuch-test-wait)\r
++            (notmuch-pick-from-search-thread)\r
++            (notmuch-test-wait)\r
++            (test-output)'\r
++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread\r
++\r
++test_begin_subtest "Pick of a single thread (from show)"\r
++test_emacs '(notmuch-hello)\r
++            (goto-char (point-min))\r
++            (re-search-forward "inbox")\r
++            (widget-button-press (1- (point)))\r
++            (notmuch-test-wait)\r
++          (notmuch-search-show-thread)\r
++            (notmuch-pick-from-show-current-query)\r
++            (notmuch-test-wait)\r
++            (test-output)'\r
++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread\r
++\r
++test_begin_subtest "Pick of a single thread (sync from show)"\r
++test_emacs '(setq notmuch-pick-asynchronous-parser nil)\r
++            (notmuch-hello)\r
++            (goto-char (point-min))\r
++            (re-search-forward "inbox")\r
++            (widget-button-press (1- (point)))\r
++            (notmuch-test-wait)\r
++          (notmuch-search-show-thread)\r
++            (notmuch-pick-from-show-current-query)\r
++            (notmuch-test-wait)\r
++            (test-output)'\r
++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread\r
++\r
++test_done\r
+diff --git a/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-single-thread b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-single-thread\r
+new file mode 100644\r
+index 0000000..c9e5ef8\r
+--- /dev/null\r
++++ b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-single-thread\r
+@@ -0,0 +1,6 @@\r
++  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message      headers (inbox)\r
++  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++  file with gcc 4.4 (inbox, unread)\r
++  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox, unread)\r
++  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox, unread)\r
++  2009-11-18  Carl Worth              ╰─► ...                                             (inbox, unread)\r
++End of search results.\r
+diff --git a/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-tag-inbox b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-tag-inbox\r
+new file mode 100644\r
+index 0000000..484141e\r
+--- /dev/null\r
++++ b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-tag-inbox\r
+@@ -0,0 +1,53 @@\r
++  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox, unread)\r
++  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox, unread)\r
++  2009-11-18  Chris Wilson          ─►[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox, unread)\r
++  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search       instead of going into an infinite loop (attachment, inbox, unread)\r
++  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox, unread)\r
++  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox, unread)\r
++  2009-11-18  Carl Worth            ╰─► ...                                               (inbox, unread)\r
++  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox, signed, unread)\r
++  2009-11-18  Keith Packard         ├─► ...                                               (inbox, unread)\r
++  2009-11-18  Carl Worth            ╰─► ...                                               (inbox, unread)\r
++  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox, unread)\r
++  2009-11-18  Keith Packard         ├─► ...                                               (inbox, unread)\r
++  2009-11-18  Carl Worth            ╰─► ...                                               (inbox, unread)\r
++  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox, unread)\r
++  2009-11-17  Jan Janak             ├─► ...                                               (inbox, unread)\r
++  2009-11-18  Carl Worth            ╰─► ...                                               (inbox, unread)\r
++  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox, unread)\r
++  2009-11-18  Carl Worth            ╰─► ...                                               (inbox, unread)\r
++  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox, unread)\r
++  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox, unread)\r
++  2009-11-18  Carl Worth             ╰─► ...                                              (inbox, unread)\r
++  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove   inbox (and unread) tags (inbox, unread)\r
++  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox, unread)\r
++  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox, signed, unread)\r
++  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox, signed, unread)\r
++  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox, signed, unread)\r
++  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox, unread)\r
++  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox, unread)\r
++  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox, signed, unread)\r
++  2009-11-18  Carl Worth            ╰─► ...                                               (inbox, unread)\r
++  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message      headers (inbox, unread)\r
++  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++  file with gcc 4.4 (inbox, unread)\r
++  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox, unread)\r
++  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox, unread)\r
++  2009-11-18  Carl Worth              ╰─► ...                                             (inbox, unread)\r
++  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that   highlights URLs and uses word-wrap (inbox, unread)\r
++  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox, unread)\r
++  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox, unread)\r
++  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox, unread)\r
++  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox, unread)\r
++  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox, unread)\r
++  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox, unread)\r
++  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox, unread)\r
++  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool      subdirectories into tags (inbox, unread)\r
++  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] count_files: sort directory in inode order before statting (inbox, unread)\r
++  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH 2/2] Read mail directory in inode number order (inbox, unread)\r
++  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++    libs. (inbox, unread)\r
++  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment, inbox, signed, unread)\r
++  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment, inbox, signed, unread)\r
++  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox, unread)\r
++  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment, inbox, unread)\r
++  2009-11-17  Carl Worth            ╰─► ...                                               (inbox, unread)\r
++End of search results.\r
+-- \r
+1.7.9.1\r
+\r