From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH v3] contrib: notmuch-pick: add tests
Date: Wed, 7 Nov 2012 20:43:27 +0000 [thread overview]
Message-ID: <1352321007-10541-1-git-send-email-markwalters1009@gmail.com> (raw)
The test should be run using the wrapper run-tests.sh. This links
the tests into the normal notmuch TEST_DIRECTORY and runs them from
there. After the test is complete then the links are removed.
---
Version 2 is at id:1351797910-19305-1-git-send-email-markwalters1009@gmail.com.
This versions fixes the bug Tomi pointed out of an unexported
variable. (I had an old symlink to notmuch-pick so it worked for me: I
have tested this version on a fresh clone of the tree.)
I have also slightly modified the message selected for testing the
message-window so that this message does not have trailing
whitespace. This avoids triggering a whitespace warning when applying
the patch.
Best wishes
Mark
contrib/notmuch-pick/README | 5 +
contrib/notmuch-pick/run-tests.sh | 46 ++++++++++++
contrib/notmuch-pick/test/emacs-pick | 78 ++++++++++++++++++++
contrib/notmuch-pick/test/emacs-pick-sync | 64 ++++++++++++++++
.../pick.expected-output/notmuch-pick-show-window | 40 ++++++++++
.../notmuch-pick-single-thread | 6 ++
.../pick.expected-output/notmuch-pick-tag-inbox | 53 +++++++++++++
7 files changed, 292 insertions(+), 0 deletions(-)
create mode 100755 contrib/notmuch-pick/run-tests.sh
create mode 100755 contrib/notmuch-pick/test/emacs-pick
create mode 100755 contrib/notmuch-pick/test/emacs-pick-sync
create mode 100644 contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-show-window
create mode 100644 contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-single-thread
create mode 100644 contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-tag-inbox
diff --git a/contrib/notmuch-pick/README b/contrib/notmuch-pick/README
index 8eed974..4200824 100644
--- a/contrib/notmuch-pick/README
+++ b/contrib/notmuch-pick/README
@@ -15,6 +15,11 @@ Then after the "(require 'notmuch)" line in your .emacs file add
the line "(require 'notmuch-pick nil t)". This will load notmuch-pick on
your next emacs start.
+TEST
+
+Just execute run-tests.sh and it should all work (it does require that
+notmuch has already been built).
+
USING PICK
The main key entries to notmuch pick are
diff --git a/contrib/notmuch-pick/run-tests.sh b/contrib/notmuch-pick/run-tests.sh
new file mode 100755
index 0000000..7ddc9cc
--- /dev/null
+++ b/contrib/notmuch-pick/run-tests.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+
+set -eu
+
+fail() {
+ echo ERROR $1
+ exit 1
+}
+
+TESTS="emacs-pick emacs-pick-sync"
+TESTFILES="$TESTS pick.expected-output"
+
+export PICK_DIR="`cd \`dirname "$0"\` && pwd`"
+PICK_TEST_DIR="$PICK_DIR/test"
+
+
+for f in $TESTFILES
+do
+ test -f "$PICK_TEST_DIR/$f" || test -d "$PICK_TEST_DIR/$f" || fail "$PICK_TEST_DIR/$f does not exist"
+done
+
+cd "$PICK_DIR/../../test"
+
+test -x ../notmuch || fail "`cd .. && pwd`/notmuch has not been built"
+
+for f in $TESTFILES
+do
+ if test -f "$f"
+ then
+ fail "$f exists"
+ fi
+done
+
+trap "rm -f $TESTFILES" 0
+
+for f in $TESTFILES
+do
+ ln -s "$PICK_TEST_DIR/$f" .
+done
+
+#don't exec -- traps would not run.
+for f in $TESTS
+do
+ echo $f
+ ./$f
+done
diff --git a/contrib/notmuch-pick/test/emacs-pick b/contrib/notmuch-pick/test/emacs-pick
new file mode 100755
index 0000000..eed5f02
--- /dev/null
+++ b/contrib/notmuch-pick/test/emacs-pick
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+test_description="emacs pick interface"
+. test-lib.sh
+
+EXPECTED=$TEST_DIRECTORY/pick.expected-output
+
+add_email_corpus
+test_begin_subtest "Do we have emacs"
+test_emacs '(insert "hello\n")
+ (test-output)'
+cat <<EOF >EXPECTED
+hello
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "Basic notmuch-pick view in emacs"
+test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
+ (require (quote notmuch-pick))
+ (notmuch-pick "tag:inbox")
+ (notmuch-test-wait)
+ (test-output)
+ (delete-other-windows)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox
+
+test_begin_subtest "Navigation of notmuch-hello to search results"
+test_emacs '(notmuch-hello)
+ (goto-char (point-min))
+ (re-search-forward "inbox")
+ (widget-button-press (1- (point)))
+ (notmuch-test-wait)
+ (notmuch-pick-from-search-current-query)
+ (notmuch-test-wait)
+ (test-output)
+ (delete-other-windows)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox
+
+test_begin_subtest "Pick of a single thread (from search)"
+test_emacs '(notmuch-hello)
+ (goto-char (point-min))
+ (re-search-forward "inbox")
+ (widget-button-press (1- (point)))
+ (notmuch-test-wait)
+ (notmuch-pick-from-search-thread)
+ (notmuch-test-wait)
+ (test-output)
+ (delete-other-windows)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread
+
+test_begin_subtest "Pick of a single thread (from show)"
+test_emacs '(notmuch-hello)
+ (goto-char (point-min))
+ (re-search-forward "inbox")
+ (widget-button-press (1- (point)))
+ (notmuch-test-wait)
+ (notmuch-search-show-thread)
+ (notmuch-pick-from-show-current-query)
+ (notmuch-test-wait)
+ (test-output)
+ (delete-other-windows)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread
+
+test_begin_subtest "Message window of pick"
+test_emacs '(notmuch-hello)
+ (goto-char (point-min))
+ (re-search-forward "inbox")
+ (widget-button-press (1- (point)))
+ (notmuch-test-wait)
+ (notmuch-search-next-thread)
+ (notmuch-pick-from-search-thread)
+ (notmuch-test-wait)
+ (select-window notmuch-pick-message-window)
+ (test-output)
+ (delete-other-windows)'
+cp OUTPUT /tmp/mjwout
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-show-window
+
+test_done
diff --git a/contrib/notmuch-pick/test/emacs-pick-sync b/contrib/notmuch-pick/test/emacs-pick-sync
new file mode 100755
index 0000000..a7da0ff
--- /dev/null
+++ b/contrib/notmuch-pick/test/emacs-pick-sync
@@ -0,0 +1,64 @@
+#!/usr/bin/env bash
+
+test_description="emacs pick interface (sync parser)"
+. test-lib.sh
+
+EXPECTED=$TEST_DIRECTORY/pick.expected-output
+
+add_email_corpus
+test_begin_subtest "Do we have emacs"
+test_emacs '(insert "hello\n")
+ (test-output)'
+cat <<EOF >EXPECTED
+hello
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "Basic notmuch-pick view in emacs"
+test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'")
+ (require (quote notmuch-pick))
+ (setq notmuch-pick-asynchronous-parser nil)
+ (notmuch-pick "tag:inbox")
+ (notmuch-test-wait)
+ (test-output)
+ (delete-other-windows)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox
+
+test_begin_subtest "Navigation of notmuch-hello to search results"
+test_emacs '(notmuch-hello)
+ (goto-char (point-min))
+ (re-search-forward "inbox")
+ (widget-button-press (1- (point)))
+ (notmuch-test-wait)
+ (notmuch-pick-from-search-current-query)
+ (notmuch-test-wait)
+ (test-output)
+ (delete-other-windows)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox
+
+test_begin_subtest "Pick of a single thread (from search)"
+test_emacs '(notmuch-hello)
+ (goto-char (point-min))
+ (re-search-forward "inbox")
+ (widget-button-press (1- (point)))
+ (notmuch-test-wait)
+ (notmuch-pick-from-search-thread)
+ (notmuch-test-wait)
+ (test-output)
+ (delete-other-windows)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread
+
+test_begin_subtest "Pick of a single thread (from show)"
+test_emacs '(notmuch-hello)
+ (goto-char (point-min))
+ (re-search-forward "inbox")
+ (widget-button-press (1- (point)))
+ (notmuch-test-wait)
+ (notmuch-search-show-thread)
+ (notmuch-pick-from-show-current-query)
+ (notmuch-test-wait)
+ (test-output)
+ (delete-other-windows)'
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread
+
+test_done
diff --git a/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-show-window b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-show-window
new file mode 100644
index 0000000..e16792b
--- /dev/null
+++ b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-show-window
@@ -0,0 +1,40 @@
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Subject: [notmuch] Working with Maildir storage?
+To: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 14:00:54 -0500
+
+[ multipart/mixed ]
+[ multipart/signed ]
+[ text/plain ]
+I saw the LWN article and decided to take a look at notmuch. I'm
+currently using mutt and mairix to index and read a collection of
+Maildir mail folders (around 40,000 messages total).
+
+notmuch indexed the messages without complaint, but my attempt at
+searching bombed out. Running, for example:
+
+ notmuch search storage
+
+Resulted in 4604 lines of errors along the lines of:
+
+ Error opening
+ /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+ Too many open files
+
+I'm curious if this is expected behavior (i.e., notmuch does not work
+with Maildir) or if something else is going on.
+
+Cheers,
+
+[ 4-line signature. Click/Enter to show. ]
+--
+Lars Kellogg-Stedman <lars@seas.harvard.edu>
+Senior Technologist, Computing and Information Technology
+Harvard University School of Engineering and Applied Sciences
+[ application/pgp-signature ]
+[ text/plain ]
+[ 4-line signature. Click/Enter to show. ]
+_______________________________________________
+notmuch mailing list
+notmuch@notmuchmail.org
+http://notmuchmail.org/mailman/listinfo/notmuch
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
new file mode 100644
index 0000000..c9e5ef8
--- /dev/null
+++ b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-single-thread
@@ -0,0 +1,6 @@
+ 2009-11-17 Mikhail Gusarov ┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox)
+ 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)
+ 2009-11-17 Carl Worth ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox, unread)
+ 2009-11-17 Keith Packard ╰┬► ... (inbox, unread)
+ 2009-11-18 Carl Worth ╰─► ... (inbox, unread)
+End of search results.
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
new file mode 100644
index 0000000..484141e
--- /dev/null
+++ b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-tag-inbox
@@ -0,0 +1,53 @@
+ 2010-12-29 François Boulogne ─►[aur-general] Guidelines: cp, mkdir vs install (inbox, unread)
+ 2010-12-16 Olivier Berger ─►Essai accentué (inbox, unread)
+ 2009-11-18 Chris Wilson ─►[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox, unread)
+ 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)
+ 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)
+ 2009-11-17 Ingmar Vanhassel ┬►[notmuch] [PATCH] Typsos (inbox, unread)
+ 2009-11-18 Carl Worth ╰─► ... (inbox, unread)
+ 2009-11-17 Adrian Perez de Cast ┬►[notmuch] Introducing myself (inbox, signed, unread)
+ 2009-11-18 Keith Packard ├─► ... (inbox, unread)
+ 2009-11-18 Carl Worth ╰─► ... (inbox, unread)
+ 2009-11-17 Israel Herraiz ┬►[notmuch] New to the list (inbox, unread)
+ 2009-11-18 Keith Packard ├─► ... (inbox, unread)
+ 2009-11-18 Carl Worth ╰─► ... (inbox, unread)
+ 2009-11-17 Jan Janak ┬►[notmuch] What a great idea! (inbox, unread)
+ 2009-11-17 Jan Janak ├─► ... (inbox, unread)
+ 2009-11-18 Carl Worth ╰─► ... (inbox, unread)
+ 2009-11-17 Jan Janak ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox, unread)
+ 2009-11-18 Carl Worth ╰─► ... (inbox, unread)
+ 2009-11-17 Aron Griffis ┬►[notmuch] archive (inbox, unread)
+ 2009-11-18 Keith Packard ╰┬► ... (inbox, unread)
+ 2009-11-18 Carl Worth ╰─► ... (inbox, unread)
+ 2009-11-17 Keith Packard ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox, unread)
+ 2009-11-18 Carl Worth ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox, unread)
+ 2009-11-17 Lars Kellogg-Stedman ┬►[notmuch] Working with Maildir storage? (inbox, signed, unread)
+ 2009-11-17 Mikhail Gusarov ├┬► ... (inbox, signed, unread)
+ 2009-11-17 Lars Kellogg-Stedman │╰┬► ... (inbox, signed, unread)
+ 2009-11-17 Mikhail Gusarov │ ├─► ... (inbox, unread)
+ 2009-11-17 Keith Packard │ ╰┬► ... (inbox, unread)
+ 2009-11-18 Lars Kellogg-Stedman │ ╰─► ... (inbox, signed, unread)
+ 2009-11-18 Carl Worth ╰─► ... (inbox, unread)
+ 2009-11-17 Mikhail Gusarov ┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox, unread)
+ 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)
+ 2009-11-17 Carl Worth ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox, unread)
+ 2009-11-17 Keith Packard ╰┬► ... (inbox, unread)
+ 2009-11-18 Carl Worth ╰─► ... (inbox, unread)
+ 2009-11-18 Keith Packard ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox, unread)
+ 2009-11-18 Alexander Botero-Low ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox, unread)
+ 2009-11-18 Alexander Botero-Low ─►[notmuch] request for pull (inbox, unread)
+ 2009-11-18 Jjgod Jiang ┬►[notmuch] Mac OS X/Darwin compatibility issues (inbox, unread)
+ 2009-11-18 Alexander Botero-Low ╰┬► ... (inbox, unread)
+ 2009-11-18 Jjgod Jiang ╰┬► ... (inbox, unread)
+ 2009-11-18 Alexander Botero-Low ╰─► ... (inbox, unread)
+ 2009-11-18 Rolland Santimano ─►[notmuch] Link to mailing list archives ? (inbox, unread)
+ 2009-11-18 Jan Janak ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox, unread)
+ 2009-11-18 Stewart Smith ─►[notmuch] [PATCH] count_files: sort directory in inode order before statting (inbox, unread)
+ 2009-11-18 Stewart Smith ─►[notmuch] [PATCH 2/2] Read mail directory in inode number order (inbox, unread)
+ 2009-11-18 Stewart Smith ─►[notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (inbox, unread)
+ 2009-11-18 Lars Kellogg-Stedman ┬►[notmuch] "notmuch help" outputs to stderr? (attachment, inbox, signed, unread)
+ 2009-11-18 Lars Kellogg-Stedman ╰─► ... (attachment, inbox, signed, unread)
+ 2009-11-17 Mikhail Gusarov ─►[notmuch] [PATCH] Handle rename of message file (inbox, unread)
+ 2009-11-17 Alex Botero-Lowry ┬►[notmuch] preliminary FreeBSD support (attachment, inbox, unread)
+ 2009-11-17 Carl Worth ╰─► ... (inbox, unread)
+End of search results.
--
1.7.9.1
next reply other threads:[~2012-11-07 20:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-07 20:43 Mark Walters [this message]
2012-11-07 21:11 ` [PATCH v3] contrib: notmuch-pick: add tests Tomi Ollila
2012-11-19 12:23 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1352321007-10541-1-git-send-email-markwalters1009@gmail.com \
--to=markwalters1009@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).