aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.local1
-rw-r--r--test/README28
-rw-r--r--test/corpus/cur/52:2,39
-rw-r--r--test/corpus/cur/53:2,20
-rwxr-xr-xtest/crypto2
-rwxr-xr-xtest/emacs60
-rwxr-xr-xtest/emacs-address-cleaning18
-rw-r--r--test/emacs-address-cleaning.el39
-rwxr-xr-xtest/emacs-large-search-buffer12
-rwxr-xr-xtest/emacs-show27
-rwxr-xr-xtest/emacs-subject-to-filename138
-rwxr-xr-xtest/emacs-test-functions9
-rw-r--r--test/emacs.expected-output/notmuch-hello8
-rw-r--r--test/emacs.expected-output/notmuch-hello-no-saved-searches6
-rw-r--r--test/emacs.expected-output/notmuch-hello-view-inbox2
-rw-r--r--test/emacs.expected-output/notmuch-hello-with-empty8
-rw-r--r--test/emacs.expected-output/notmuch-search-tag-inbox2
-rw-r--r--test/emacs.expected-output/notmuch-show-thread-maildir-storage33
-rw-r--r--test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation33
-rw-r--r--test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation33
-rwxr-xr-xtest/encoding4
-rwxr-xr-xtest/from-guessing126
-rwxr-xr-xtest/maildir-sync4
-rwxr-xr-xtest/multipart12
-rwxr-xr-xtest/notmuch-test5
-rwxr-xr-xtest/python20
-rwxr-xr-xtest/raw4
-rwxr-xr-xtest/reply74
-rwxr-xr-xtest/reply-to-sender209
-rwxr-xr-xtest/search38
-rwxr-xr-xtest/search-output16
-rwxr-xr-xtest/search-position-overlap-bug4
-rwxr-xr-xtest/symbol-hiding4
-rw-r--r--test/test-lib.el53
-rw-r--r--test/test-lib.sh54
-rwxr-xr-xtest/thread-naming30
36 files changed, 932 insertions, 243 deletions
diff --git a/test/Makefile.local b/test/Makefile.local
index fa2df734..4a6a4b12 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -28,6 +28,7 @@ test: all test-binaries
check: test
+SRCS := $(SRCS) $(smtp_dummy_srcs)
CLEAN := $(CLEAN) $(dir)/smtp-dummy $(dir)/smtp-dummy.o \
$(dir)/symbol-test $(dir)/symbol-test.o \
$(dir)/arg-test $(dir)/arg-test.o
diff --git a/test/README b/test/README
index 7b2e96d4..43656a35 100644
--- a/test/README
+++ b/test/README
@@ -6,6 +6,19 @@ When fixing bugs or enhancing notmuch, you are strongly encouraged to
add tests in this directory to cover what you are trying to fix or
enhance.
+Prerequisites
+-------------
+Some tests require external dependencies to run. Without them, they
+will be skipped, or (rarely) marked failed. Please install these, so
+that you know if you break anything.
+
+ - dtach(1)
+ - emacs(1)
+ - emacsclient(1)
+ - gdb(1)
+ - gpg(1)
+ - python(1)
+
Running Tests
-------------
The easiest way to run tests is to say "make test", (or simply run the
@@ -56,6 +69,13 @@ can be specified as follows:
make test OPTIONS="--verbose"
+You can choose an emacs binary to run the tests in one of the
+following ways.
+
+ TEST_EMACS=my-special-emacs make test
+ TEST_EMACS=my-special-emacs ./emacs
+ make test TEST_EMACS=my-special-emacs
+
Skipping Tests
--------------
If, for any reason, you need to skip one or more tests, you can do so
@@ -182,6 +202,14 @@ library for your script to use.
tests that may run in the same Emacs instance. Use `let' instead
so the scope of the changed variables is limited to a single test.
+ test_emacs_expect_t <emacs-lisp-expressions>
+
+ This function executes the provided emacs lisp script within
+ emacs in a manner similar to 'test_emacs'. The expressions should
+ return the value `t' to indicate that the test has passed. If the
+ test does not return `t' then it is considered failed and all data
+ returned by the test is reported to the tester.
+
test_done
Your test script must have test_done at the end. Its purpose
diff --git a/test/corpus/cur/52:2, b/test/corpus/cur/52:2,
new file mode 100644
index 00000000..60283404
--- /dev/null
+++ b/test/corpus/cur/52:2,
@@ -0,0 +1,39 @@
+Message-ID: <4EFC743A.3060609@april.org>
+Date: Thu, 29 Dec 2010 15:07:54 +0100
+From: "=?ISO-8859-1?Q?Fran=E7ois_Boulogne?=" <boulogne.f@gmail.com>
+User-Agent: Mozilla/5.0 (X11; Linux i686;
+ rv:9.0) Gecko/20111224 Thunderbird/9.0.1
+MIME-Version: 1.0
+To: Allan McRae <allan@archlinux.org>,
+ "Discussion about the Arch User Repository (AUR)" <aur-general@archlinux.org>
+References: <4EFC3931.6030007@april.org> <4EFC3D62.4030202@archlinux.org>
+In-Reply-To: <4EFC3D62.4030202@archlinux.org>
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+Subject: Re: [aur-general] Guidelines: cp, mkdir vs install
+
+Le 29/12/2011 11:13, Allan McRae a écrit :
+> On 29/12/11 19:56, François Boulogne wrote:
+>> Hi,
+>>
+>> Looking to improve the quality of my packages, I read again the guidelines.
+>> https://wiki.archlinux.org/index.php/Arch_Packaging_Standards
+>>
+>> However, it don't see anything about the install command like
+>> install -d $pkgdir/usr/{bin,share/man/man1,share/locale}
+>>
+>> Some contributors on AUR use cp or mkdir to install files/dir (when no
+>> makefile is provided) and others use install command.
+>>
+>> What's the opinion of TU on this point?
+>>
+>
+> Use install with -m specifying the correct permissions
+>
+
+Thank you Allan
+
+
+--
+François Boulogne.
+https://www.sciunto.org
diff --git a/test/corpus/cur/53:2, b/test/corpus/cur/53:2,
new file mode 100644
index 00000000..7a1e2e58
--- /dev/null
+++ b/test/corpus/cur/53:2,
@@ -0,0 +1,20 @@
+From: Olivier Berger <olivier.berger@it-sudparis.eu>
+To: olivier.berger@it-sudparis.eu
+Subject: Essai =?iso-8859-1?Q?accentu=E9?=
+User-Agent: Notmuch/0.10.1 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu)
+X-Draft-From: ("nnimap+localdovecot:INBOX" 44228)
+Date: Fri, 16 Dec 2010 16:49:59 +0100
+Message-ID: <877h1wv7mg.fsf@inf-8657.int-evry.fr>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=iso-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+Du texte accentu=E9 pour =E7a ...
+
+=E0 la bonne heure !
+--=20
+Olivier BERGER=20
+http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
+Ingenieur Recherche - Dept INF
+Institut TELECOM, SudParis (http://www.it-sudparis.eu/), Evry (France)
+
diff --git a/test/crypto b/test/crypto
index 0af4aa8a..446a58b7 100755
--- a/test/crypto
+++ b/test/crypto
@@ -104,6 +104,8 @@ test_expect_equal \
"$expected"
test_begin_subtest "signature verification with signer key unavailable"
+# this is broken with current versions of gmime-2.6
+(ldd $(which notmuch) | grep -Fq gmime-2.6) && test_subtest_known_broken
# move the gnupghome temporarily out of the way
mv "${GNUPGHOME}"{,.bak}
output=$(notmuch show --format=json --verify subject:"test signed message 001" \
diff --git a/test/emacs b/test/emacs
index 2d066ed4..f4a5c816 100755
--- a/test/emacs
+++ b/test/emacs
@@ -78,10 +78,10 @@ thread=$(notmuch search --output=threads subject:message-with-invalid-from)
test_emacs "(notmuch-show \"$thread\")
(test-output)"
cat <<EOF >EXPECTED
-"Invalid " From" <test_suite@notmuchmail.org> (2001-01-05) (inbox)
+Invalid " From <test_suite@notmuchmail.org> (2001-01-05) (inbox)
Subject: message-with-invalid-from
To: Notmuch Test Suite <test_suite@notmuchmail.org>
-Date: Tue, 05 Jan 2001 15:43:57 -0000
+Date: Fri, 05 Jan 2001 15:43:57 +0000
This is just a test message (#1)
EOF
@@ -225,7 +225,7 @@ test_expect_equal_file OUTPUT EXPECTED
mkdir -p mail/sent-list-catch-all/cur
mkdir -p mail/sent-list-catch-all/new
mkdir -p mail/sent-list-catch-all/tmp
-
+
test_begin_subtest "notmuch-fcc-dirs set to a list (catch-all)"
test_emacs "(let ((notmuch-fcc-dirs
'((\"example.com\" . \"failure\")
@@ -340,7 +340,7 @@ add_message '[from]="Top Poster <top@poster.com>"' \
----- Original Message -----
From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmai.org>
-Sent: Tue, 05 Jan 2001 15:43:57 -0000
+Sent: Fri, 05 Jan 2001 15:43:57 +0000
Subject: The problem with top-posting
Q: Why is top-posting such a bad thing?
@@ -351,7 +351,7 @@ test_emacs "(notmuch-show \"top-posting\")
echo "Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
Subject: The problem with top-posting
To: Notmuch Test Suite <test_suite@notmuchmail.org>
-Date: Tue, 05 Jan 2001 15:43:57 -0000
+Date: Fri, 05 Jan 2001 15:43:57 +0000
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
@@ -360,7 +360,7 @@ Q: What is the most annoying thing in e-mail?
Top Poster <top@poster.com> (2001-01-05) (inbox unread)
Subject: Re: The problem with top-posting
To: Notmuch Test Suite <test_suite@notmuchmail.org>
-Date: Tue, 05 Jan 2001 15:43:57 -0000
+Date: Fri, 05 Jan 2001 15:43:57 +0000
Thanks for the advice! I will be sure to put it to good use.
@@ -393,22 +393,22 @@ add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
'[body]="Unable to stash body. Where did you get it in the first place?!?"'
notmuch tag +stashtest id:${gen_msg_id}
test_emacs '(notmuch-show "id:\"bought\"")
- (notmuch-show-stash-date)
- (notmuch-show-stash-from)
- (notmuch-show-stash-to)
- (notmuch-show-stash-cc)
- (notmuch-show-stash-subject)
- (notmuch-show-stash-message-id)
- (notmuch-show-stash-message-id-stripped)
- (notmuch-show-stash-tags)
- (notmuch-show-stash-filename)
- (switch-to-buffer
- (generate-new-buffer "*test-stashing*"))
- (dotimes (i 9)
- (yank)
- (insert "\n")
- (rotate-yank-pointer 1))
- (reverse-region (point-min) (point-max))
+ (notmuch-show-stash-date)
+ (notmuch-show-stash-from)
+ (notmuch-show-stash-to)
+ (notmuch-show-stash-cc)
+ (notmuch-show-stash-subject)
+ (notmuch-show-stash-message-id)
+ (notmuch-show-stash-message-id-stripped)
+ (notmuch-show-stash-tags)
+ (notmuch-show-stash-filename)
+ (switch-to-buffer
+ (generate-new-buffer "*test-stashing*"))
+ (dotimes (i 9)
+ (yank)
+ (insert "\n")
+ (rotate-yank-pointer 1))
+ (reverse-region (point-min) (point-max))
(test-output)'
cat <<EOF >EXPECTED
Sat, 01 Jan 2000 12:00:00 -0000
@@ -425,11 +425,11 @@ test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest "Stashing in notmuch-search"
test_emacs '(notmuch-search "id:\"bought\"")
- (notmuch-test-wait)
- (notmuch-search-stash-thread-id)
- (switch-to-buffer
- (generate-new-buffer "*test-stashing*"))
- (yank)
+ (notmuch-test-wait)
+ (notmuch-search-stash-thread-id)
+ (switch-to-buffer
+ (generate-new-buffer "*test-stashing*"))
+ (yank)
(test-output)'
sed -i -e 's/^thread:.*$/thread:XXX/' OUTPUT
test_expect_equal "$(cat OUTPUT)" "thread:XXX"
@@ -458,9 +458,9 @@ test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest "Refresh modified show buffer"
test_subtest_known_broken
test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
- (notmuch-show-toggle-message)
- (notmuch-show-next-message)
- (notmuch-show-toggle-message)
+ (notmuch-show-toggle-message)
+ (notmuch-show-next-message)
+ (notmuch-show-toggle-message)
(test-visible-output "EXPECTED")
(notmuch-show-refresh-view)
(test-visible-output)'
diff --git a/test/emacs-address-cleaning b/test/emacs-address-cleaning
new file mode 100755
index 00000000..51018fe5
--- /dev/null
+++ b/test/emacs-address-cleaning
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+test_description="emacs address cleaning"
+. test-lib.sh
+
+test_begin_subtest "notmuch-test-address-clean part 1"
+test_emacs_expect_t \
+ '(load "emacs-address-cleaning.el") (notmuch-test-address-cleaning-1)'
+
+test_begin_subtest "notmuch-test-address-clean part 2"
+test_emacs_expect_t \
+ '(load "emacs-address-cleaning.el") (notmuch-test-address-cleaning-2)'
+
+test_begin_subtest "notmuch-test-address-clean part 3"
+test_emacs_expect_t \
+ '(load "emacs-address-cleaning.el") (notmuch-test-address-cleaning-3)'
+
+test_done
diff --git a/test/emacs-address-cleaning.el b/test/emacs-address-cleaning.el
new file mode 100644
index 00000000..8423245f
--- /dev/null
+++ b/test/emacs-address-cleaning.el
@@ -0,0 +1,39 @@
+(defun notmuch-test-address-cleaning-1 ()
+ (notmuch-test-expect-equal (notmuch-show-clean-address "dme@dme.org")
+ "dme@dme.org"))
+
+(defun notmuch-test-address-cleaning-2 ()
+ (let* ((input '("foo@bar.com"
+ "<foo@bar.com>"
+ "Foo Bar <foo@bar.com>"
+ "foo@bar.com <foo@bar.com>"
+ "\"Foo Bar\" <foo@bar.com>"))
+ (expected '("foo@bar.com"
+ "foo@bar.com"
+ "Foo Bar <foo@bar.com>"
+ "foo@bar.com"
+ "Foo Bar <foo@bar.com>"))
+ (output (mapcar #'notmuch-show-clean-address input)))
+ (notmuch-test-expect-equal output expected)))
+
+(defun notmuch-test-address-cleaning-3 ()
+ (let* ((input '("ДБ <db-uknot@stop.me.uk>"
+ "foo (at home) <foo@bar.com>"
+ "foo [at home] <foo@bar.com>"
+ "Foo Bar"
+ "'Foo Bar' <foo@bar.com>"
+ "\"'Foo Bar'\" <foo@bar.com>"
+ "'\"Foo Bar\"' <foo@bar.com>"
+ "'\"'Foo Bar'\"' <foo@bar.com>"
+ "Fred Dibna \\[extraordinaire\\] <fred@dibna.com>"))
+ (expected '("ДБ <db-uknot@stop.me.uk>"
+ "foo (at home) <foo@bar.com>"
+ "foo [at home] <foo@bar.com>"
+ "Foo Bar"
+ "Foo Bar <foo@bar.com>"
+ "Foo Bar <foo@bar.com>"
+ "Foo Bar <foo@bar.com>"
+ "Foo Bar <foo@bar.com>"
+ "Fred Dibna [extraordinaire] <fred@dibna.com>"))
+ (output (mapcar #'notmuch-show-clean-address input)))
+ (notmuch-test-expect-equal output expected)))
diff --git a/test/emacs-large-search-buffer b/test/emacs-large-search-buffer
index 6095e9da..4351e33e 100755
--- a/test/emacs-large-search-buffer
+++ b/test/emacs-large-search-buffer
@@ -19,25 +19,25 @@ done
notmuch new > /dev/null
test_begin_subtest "Ensure that emacs doesn't drop results"
-notmuch search '*' > EXPEXTED
-sed -i -e 's/^thread:[0-9a-f]* //' -e 's/;//' -e 's/xx*/[BLOB]/' EXPEXTED
-echo 'End of search results.' >> EXPEXTED
+notmuch search '*' > EXPECTED
+sed -i -e 's/^thread:[0-9a-f]* //' -e 's/;//' -e 's/xx*/[BLOB]/' EXPECTED
+echo 'End of search results.' >> EXPECTED
test_emacs '(notmuch-search "*")
(notmuch-test-wait)
(test-output)'
sed -i -e s', *, ,g' -e 's/xxx*/[BLOB]/g' OUTPUT
-test_expect_equal_file OUTPUT EXPEXTED
+test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest "Ensure that emacs doesn't drop error messages"
test_emacs '(notmuch-search "--this-option-does-not-exist")
(notmuch-test-wait)
(test-output)'
-cat <<EOF >EXPEXTED
+cat <<EOF >EXPECTED
Error: Unexpected output from notmuch search:
Unrecognized option: --this-option-does-not-exist
End of search results. (process returned 1)
EOF
-test_expect_equal_file OUTPUT EXPEXTED
+test_expect_equal_file OUTPUT EXPECTED
test_done
diff --git a/test/emacs-show b/test/emacs-show
new file mode 100755
index 00000000..5700d2e7
--- /dev/null
+++ b/test/emacs-show
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+test_description="Testing emacs notmuch-show view"
+. test-lib.sh
+
+test_begin_subtest "Hiding Original Message region at beginning of a message"
+message_id='OriginalMessageHiding.1@notmuchmail.org'
+add_message \
+ [id]="$message_id" \
+ '[subject]="Hiding Original Message region at beginning of a message"' \
+ '[body]="-----Original Message-----
+Text here."'
+
+cat <<EOF >EXPECTED
+Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
+Subject: Hiding Original Message region at beginning of a message
+To: Notmuch Test Suite <test_suite@notmuchmail.org>
+Date: Fri, 05 Jan 2001 15:43:57 +0000
+
+[ 2-line hidden original message. Click/Enter to show. ]
+EOF
+
+test_emacs "(notmuch-show \"id:$message_id\")
+ (test-visible-output)"
+test_expect_equal_file OUTPUT EXPECTED
+
+test_done
diff --git a/test/emacs-subject-to-filename b/test/emacs-subject-to-filename
new file mode 100755
index 00000000..176e6859
--- /dev/null
+++ b/test/emacs-subject-to-filename
@@ -0,0 +1,138 @@
+#!/usr/bin/env bash
+
+test_description="emacs: mail subject to filename"
+. test-lib.sh
+
+# emacs server can't be started in a child process with $(test_emacs ...)
+test_emacs '(ignore)'
+
+# test notmuch-wash-subject-to-patch-sequence-number (subject)
+test_begin_subtest "no patch sequence number"
+output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
+ "[PATCH] A normal patch subject without numbers")'
+)
+test_expect_equal "$output" ""
+
+test_begin_subtest "patch sequence number #1"
+output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
+ "[PATCH 2/3] A most regular patch subject")'
+)
+test_expect_equal "$output" 2
+
+test_begin_subtest "patch sequence number #2"
+output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
+ " [dummy list prefix] [RFC PATCH v2 13/42] Special prefixes")'
+)
+test_expect_equal "$output" 13
+
+test_begin_subtest "patch sequence number #3"
+output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
+ "[PATCH 2/3] [PATCH 032/037] use the last prefix")'
+)
+test_expect_equal "$output" 32
+
+test_begin_subtest "patch sequence number #4"
+output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
+ "[dummy list prefix] [PATCH 2/3] PATCH 3/3] do not use a broken prefix")'
+)
+test_expect_equal "$output" 2
+
+test_begin_subtest "patch sequence number #5"
+output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
+ "[RFC][PATCH 3/5][PATCH 4/5][PATCH 5/5] A made up test")'
+)
+test_expect_equal "$output" 5
+
+test_begin_subtest "patch sequence number #6"
+output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
+ "[PATCH 2/3] this -> [PATCH 3/3] is not a prefix anymore [nor this 4/4]")'
+)
+test_expect_equal "$output" 2
+
+test_begin_subtest "patch sequence number #7"
+output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
+ "[liberally accept crapola right before123/456and after] the numbers")'
+)
+test_expect_equal "$output" 123
+
+# test notmuch-wash-subject-to-filename (subject &optional maxlen)
+test_begin_subtest "filename #1"
+output=$(test_emacs '(notmuch-wash-subject-to-filename
+ "just a subject line")'
+)
+test_expect_equal $output '"just-a-subject-line"'
+
+test_begin_subtest "filename #2"
+output=$(test_emacs '(notmuch-wash-subject-to-filename
+ " [any] [prefixes are ] [removed!] from the subject")'
+)
+test_expect_equal $output '"from-the-subject"'
+
+test_begin_subtest "filename #3"
+output=$(test_emacs '(notmuch-wash-subject-to-filename
+ " leading and trailing space ")'
+)
+test_expect_equal $output '"leading-and-trailing-space"'
+
+test_begin_subtest "filename #4"
+output=$(test_emacs '(notmuch-wash-subject-to-filename
+ "!# leading ()// &%, and in between_and_trailing garbage ()(&%%")'
+)
+test_expect_equal $output '"-leading-and-in-between_and_trailing-garbage"'
+
+test_begin_subtest "filename #5"
+output=$(test_emacs '(notmuch-wash-subject-to-filename
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_01234567890")'
+)
+test_expect_equal $output '"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_01234567890"'
+
+test_begin_subtest "filename #6"
+output=$(test_emacs '(notmuch-wash-subject-to-filename
+ "sequences of ... are squashed and trailing are removed ...")'
+)
+test_expect_equal $output '"sequences-of-.-are-squashed-and-trailing-are-removed"'
+
+test_begin_subtest "filename #7"
+output=$(test_emacs '(notmuch-wash-subject-to-filename
+ "max length test" 1)'
+)
+test_expect_equal $output '"m"'
+
+test_begin_subtest "filename #8"
+output=$(test_emacs '(notmuch-wash-subject-to-filename
+ "max length test /&(/%&/%%&¤%¤" 20)'
+)
+test_expect_equal $output '"max-length-test"'
+
+test_begin_subtest "filename #9"
+output=$(test_emacs '(notmuch-wash-subject-to-filename
+ "[a prefix] [is only separated] by [spaces], so \"by\" is not okay!")'
+)
+test_expect_equal $output '"by-spaces-so-by-is-not-okay"'
+
+# test notmuch-wash-subject-to-patch-filename (subject)
+test_begin_subtest "patch filename #1"
+output=$(test_emacs '(notmuch-wash-subject-to-patch-filename
+ "[RFC][PATCH 099/100] rewrite notmuch")'
+)
+test_expect_equal "$output" '"0099-rewrite-notmuch.patch"'
+
+test_begin_subtest "patch filename #2"
+output=$(test_emacs '(notmuch-wash-subject-to-patch-filename
+ "[RFC PATCH v1] has no patch number, default to 1")'
+)
+test_expect_equal "$output" '"0001-has-no-patch-number-default-to-1.patch"'
+
+test_begin_subtest "patch filename #3"
+output=$(test_emacs '(notmuch-wash-subject-to-patch-filename
+ "[PATCH 4/5] the maximum length of a patch filename is 52 + patch sequence number + .patch extension")'
+)
+test_expect_equal "$output" '"0004-the-maximum-length-of-a-patch-filename-is-52-patch-s.patch"'
+
+test_begin_subtest "patch filename #4"
+output=$(test_emacs '(notmuch-wash-subject-to-patch-filename
+ "[PATCH 4/5] the maximum length of a patch filename is 52 + patchh ! sequence number + .patch extension, *before* trimming trailing - and .")'
+)
+test_expect_equal "$output" '"0004-the-maximum-length-of-a-patch-filename-is-52-patchh.patch"'
+
+test_done
diff --git a/test/emacs-test-functions b/test/emacs-test-functions
new file mode 100755
index 00000000..0e1f9fc7
--- /dev/null
+++ b/test/emacs-test-functions
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+test_description="emacs test function sanity"
+. test-lib.sh
+
+test_begin_subtest "emacs test function sanity"
+test_emacs_expect_t 't'
+
+test_done
diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello
index 48143bd7..3e59595f 100644
--- a/test/emacs.expected-output/notmuch-hello
+++ b/test/emacs.expected-output/notmuch-hello
@@ -1,14 +1,14 @@
- Welcome to notmuch. You have 50 messages.
+ Welcome to notmuch. You have 52 messages.
Saved searches: [edit]
- 50 inbox 50 unread
+ 52 inbox 52 unread
-Search:
+Search: .
[Show all tags]
Type a search query and hit RET to view matching threads.
Edit saved searches with the `edit' button.
Hit RET or click on a saved search or tag name to view matching threads.
- `=' refreshes this screen. `s' jumps to the search box. `q' to quit.
+ `=' to refresh this screen. `s' to search messages. `q' to quit.
diff --git a/test/emacs.expected-output/notmuch-hello-no-saved-searches b/test/emacs.expected-output/notmuch-hello-no-saved-searches
index 7c09e40b..ef0e5d05 100644
--- a/test/emacs.expected-output/notmuch-hello-no-saved-searches
+++ b/test/emacs.expected-output/notmuch-hello-no-saved-searches
@@ -1,10 +1,10 @@
- Welcome to notmuch. You have 50 messages.
+ Welcome to notmuch. You have 52 messages.
-Search:
+Search: .
[Show all tags]
Type a search query and hit RET to view matching threads.
Edit saved searches with the `edit' button.
Hit RET or click on a saved search or tag name to view matching threads.
- `=' refreshes this screen. `s' jumps to the search box. `q' to quit.
+ `=' to refresh this screen. `s' to search messages. `q' to quit.
diff --git a/test/emacs.expected-output/notmuch-hello-view-inbox b/test/emacs.expected-output/notmuch-hello-view-inbox
index 894ae5fa..1688d674 100644
--- a/test/emacs.expected-output/notmuch-hello-view-inbox
+++ b/test/emacs.expected-output/notmuch-hello-view-inbox
@@ -20,4 +20,6 @@
2009-11-18 [1/1] Alexander Botero-Lowry [notmuch] request for pull (inbox unread)
2009-11-18 [2/2] Keith Packard, Alexander Botero-Lowry [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
2009-11-18 [1/1] Chris Wilson [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox unread)
+ 2010-12-16 [1/1] Olivier Berger Essai accentué (inbox unread)
+ 2010-12-29 [1/1] François Boulogne [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
End of search results.
diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty
index 2a267c92..71edba73 100644
--- a/test/emacs.expected-output/notmuch-hello-with-empty
+++ b/test/emacs.expected-output/notmuch-hello-with-empty
@@ -1,14 +1,14 @@
- Welcome to notmuch. You have 50 messages.
+ Welcome to notmuch. You have 52 messages.
Saved searches: [edit]
- 50 inbox 50 unread 0 empty
+ 52 inbox 52 unread 0 empty
-Search:
+Search: .
[Show all tags]
Type a search query and hit RET to view matching threads.
Edit saved searches with the `edit' button.
Hit RET or click on a saved search or tag name to view matching threads.
- `=' refreshes this screen. `s' jumps to the search box. `q' to quit.
+ `=' to refresh this screen. `s' to search messages. `q' to quit.
diff --git a/test/emacs.expected-output/notmuch-search-tag-inbox b/test/emacs.expected-output/notmuch-search-tag-inbox
index 9456ccfd..8a53555a 100644
--- a/test/emacs.expected-output/notmuch-search-tag-inbox
+++ b/test/emacs.expected-output/notmuch-search-tag-inbox
@@ -1,3 +1,5 @@
+ 2010-12-29 [1/1] François Boulogne [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
+ 2010-12-16 [1/1] Olivier Berger Essai accentué (inbox unread)
2009-11-18 [1/1] Chris Wilson [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox unread)
2009-11-18 [2/2] Alex Botero-Lowry, Carl Worth [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
2009-11-18 [2/2] Ingmar Vanhassel, Carl Worth [notmuch] [PATCH] Typsos (inbox unread)
diff --git a/test/emacs.expected-output/notmuch-show-thread-maildir-storage b/test/emacs.expected-output/notmuch-show-thread-maildir-storage
index 8ba64b27..cdbfa1d7 100644
--- a/test/emacs.expected-output/notmuch-show-thread-maildir-storage
+++ b/test/emacs.expected-output/notmuch-show-thread-maildir-storage
@@ -26,12 +26,11 @@ with Maildir) or if something else is going on.
Cheers,
-[ 5-line signature. Click/Enter to show. ]
+[ 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. ]
@@ -48,12 +47,14 @@ http://notmuchmail.org/mailman/listinfo/notmuch
[ multipart/signed ]
[ text/plain ]
- Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did gyre and gimble:
+ Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did
+ gyre and gimble:
LK> Resulted in 4604 lines of errors along the lines of:
LK> Error opening
- LK> /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+ LK>
+ /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
LK> Too many open files
See the patch just posted here.
@@ -88,12 +89,11 @@ http://notmuchmail.org/mailman/listinfo/notmuch
-- Lars
- [ 5-line signature. Click/Enter to show. ]
+ [ 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. ]
@@ -106,8 +106,8 @@ http://notmuchmail.org/mailman/listinfo/notmuch
To: notmuch@notmuchmail.org
Date: Wed, 18 Nov 2009 02:50:48 +0600
-
- Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu did gyre and gimble:
+ Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu
+ did gyre and gimble:
LK> Is the list archived anywhere? The obvious archives
LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
@@ -127,14 +127,15 @@ http://notmuchmail.org/mailman/listinfo/notmuch
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
- URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091118/0e33d964/attachment.pgp>
-
+ URL:
+ <http://notmuchmail.org/pipermail/notmuch/attachments/20091118/0e33d964/attachment.pgp>
Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
Subject: [notmuch] Working with Maildir storage?
To: notmuch@notmuchmail.org
Date: Tue, 17 Nov 2009 13:24:13 -0800
- On Tue, 17 Nov 2009 15:33:01 -0500, Lars Kellogg-Stedman <lars at seas.harvard.edu> wrote:
+ On Tue, 17 Nov 2009 15:33:01 -0500, Lars Kellogg-Stedman <lars at
+ seas.harvard.edu> wrote:
> > See the patch just posted here.
I've also pushed a slightly more complicated (and complete) fix to my
@@ -150,7 +151,6 @@ http://notmuchmail.org/mailman/listinfo/notmuch
Thanks to everyone for trying out notmuch!
-keith
-
Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
Subject: Re: [notmuch] Working with Maildir storage?
To: Keith Packard <keithp@keithp.com>
@@ -166,12 +166,11 @@ http://notmuchmail.org/mailman/listinfo/notmuch
The version of lib/messages.cc in your repo doesn't build because it's
missing "#include <stdint.h>" (for the uint32_t on line 466).
- [ 5-line signature. Click/Enter to show. ]
+ [ 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. ]
@@ -184,7 +183,8 @@ http://notmuchmail.org/mailman/listinfo/notmuch
To: notmuch@notmuchmail.org
Date: Wed, 18 Nov 2009 02:08:10 -0800
- On Tue, 17 Nov 2009 14:00:54 -0500, Lars Kellogg-Stedman <lars at seas.harvard.edu> wrote:
+ On Tue, 17 Nov 2009 14:00:54 -0500, Lars Kellogg-Stedman <lars at
+ seas.harvard.edu> wrote:
> 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).
@@ -195,7 +195,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch
That's very interesting. So, thanks for coming and trying out notmuch.
> Error opening
- > /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+ > /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
> Too many open files
Sadly, the lwn article coincided with me having just introduced this
@@ -212,4 +212,3 @@ http://notmuchmail.org/mailman/listinfo/notmuch
Happy hacking,
-Carl
-
diff --git a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation
index 41e2aaa3..b0bf93ed 100644
--- a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation
+++ b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation
@@ -26,12 +26,11 @@ with Maildir) or if something else is going on.
Cheers,
-[ 5-line signature. Click/Enter to show. ]
+[ 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. ]
@@ -48,12 +47,14 @@ http://notmuchmail.org/mailman/listinfo/notmuch
[ multipart/signed ]
[ text/plain ]
- Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did gyre and gimble:
+ Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did
+ gyre and gimble:
LK> Resulted in 4604 lines of errors along the lines of:
LK> Error opening
- LK> /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+ LK>
+ /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
LK> Too many open files
See the patch just posted here.
@@ -88,12 +89,11 @@ http://notmuchmail.org/mailman/listinfo/notmuch
-- Lars
- [ 5-line signature. Click/Enter to show. ]
+ [ 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. ]
@@ -106,8 +106,8 @@ http://notmuchmail.org/mailman/listinfo/notmuch
To: notmuch@notmuchmail.org
Date: Wed, 18 Nov 2009 02:50:48 +0600
-
- Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu did gyre and gimble:
+ Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu
+ did gyre and gimble:
LK> Is the list archived anywhere? The obvious archives
LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
@@ -127,14 +127,15 @@ http://notmuchmail.org/mailman/listinfo/notmuch
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
- URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091118/0e33d964/attachment.pgp>
-
+ URL:
+ <http://notmuchmail.org/pipermail/notmuch/attachments/20091118/0e33d964/attachment.pgp>
Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
Subject: [notmuch] Working with Maildir storage?
To: notmuch@notmuchmail.org
Date: Tue, 17 Nov 2009 13:24:13 -0800
- On Tue, 17 Nov 2009 15:33:01 -0500, Lars Kellogg-Stedman <lars at seas.harvard.edu> wrote:
+ On Tue, 17 Nov 2009 15:33:01 -0500, Lars Kellogg-Stedman <lars at
+ seas.harvard.edu> wrote:
> > See the patch just posted here.
I've also pushed a slightly more complicated (and complete) fix to my
@@ -150,7 +151,6 @@ http://notmuchmail.org/mailman/listinfo/notmuch
Thanks to everyone for trying out notmuch!
-keith
-
Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
Subject: Re: [notmuch] Working with Maildir storage?
To: Keith Packard <keithp@keithp.com>
@@ -166,12 +166,11 @@ http://notmuchmail.org/mailman/listinfo/notmuch
The version of lib/messages.cc in your repo doesn't build because it's
missing "#include <stdint.h>" (for the uint32_t on line 466).
- [ 5-line signature. Click/Enter to show. ]
+ [ 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. ]
@@ -184,7 +183,8 @@ http://notmuchmail.org/mailman/listinfo/notmuch
To: notmuch@notmuchmail.org
Date: Wed, 18 Nov 2009 02:08:10 -0800
- On Tue, 17 Nov 2009 14:00:54 -0500, Lars Kellogg-Stedman <lars at seas.harvard.edu> wrote:
+ On Tue, 17 Nov 2009 14:00:54 -0500, Lars Kellogg-Stedman <lars at
+ seas.harvard.edu> wrote:
> 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).
@@ -195,7 +195,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch
That's very interesting. So, thanks for coming and trying out notmuch.
> Error opening
- > /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+ > /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
> Too many open files
Sadly, the lwn article coincided with me having just introduced this
@@ -212,4 +212,3 @@ http://notmuchmail.org/mailman/listinfo/notmuch
Happy hacking,
-Carl
-
diff --git a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation
index fa2108ef..08de8b5d 100644
--- a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation
+++ b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation
@@ -26,12 +26,11 @@ with Maildir) or if something else is going on.
Cheers,
-[ 5-line signature. Click/Enter to show. ]
+[ 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. ]
@@ -48,12 +47,14 @@ Date: Wed, 18 Nov 2009 01:02:38 +0600
[ multipart/signed ]
[ text/plain ]
-Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did gyre and gimble:
+Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did
+gyre and gimble:
LK> Resulted in 4604 lines of errors along the lines of:
LK> Error opening
- LK> /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+ LK>
+/home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
LK> Too many open files
See the patch just posted here.
@@ -88,12 +89,11 @@ It doesn't look like the patch is in git yet.
-- Lars
-[ 5-line signature. Click/Enter to show. ]
+[ 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. ]
@@ -106,8 +106,8 @@ Subject: [notmuch] Working with Maildir storage?
To: notmuch@notmuchmail.org
Date: Wed, 18 Nov 2009 02:50:48 +0600
-
-Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu did gyre and gimble:
+Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu
+did gyre and gimble:
LK> Is the list archived anywhere? The obvious archives
LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
@@ -127,14 +127,15 @@ Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
-URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091118/0e33d964/attachment.pgp>
-
+URL:
+<http://notmuchmail.org/pipermail/notmuch/attachments/20091118/0e33d964/attachment.pgp>
Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
Subject: [notmuch] Working with Maildir storage?
To: notmuch@notmuchmail.org
Date: Tue, 17 Nov 2009 13:24:13 -0800
-On Tue, 17 Nov 2009 15:33:01 -0500, Lars Kellogg-Stedman <lars at seas.harvard.edu> wrote:
+On Tue, 17 Nov 2009 15:33:01 -0500, Lars Kellogg-Stedman <lars at
+seas.harvard.edu> wrote:
> > See the patch just posted here.
I've also pushed a slightly more complicated (and complete) fix to my
@@ -150,7 +151,6 @@ Barcelona today and so it won't get fixed for a while.
Thanks to everyone for trying out notmuch!
-keith
-
Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
Subject: Re: [notmuch] Working with Maildir storage?
To: Keith Packard <keithp@keithp.com>
@@ -166,12 +166,11 @@ Date: Tue, 17 Nov 2009 19:50:40 -0500
The version of lib/messages.cc in your repo doesn't build because it's
missing "#include <stdint.h>" (for the uint32_t on line 466).
-[ 5-line signature. Click/Enter to show. ]
+[ 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. ]
@@ -184,7 +183,8 @@ Subject: [notmuch] Working with Maildir storage?
To: notmuch@notmuchmail.org
Date: Wed, 18 Nov 2009 02:08:10 -0800
-On Tue, 17 Nov 2009 14:00:54 -0500, Lars Kellogg-Stedman <lars at seas.harvard.edu> wrote:
+On Tue, 17 Nov 2009 14:00:54 -0500, Lars Kellogg-Stedman <lars at
+seas.harvard.edu> wrote:
> 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).
@@ -195,7 +195,7 @@ I hadn't even seen that Keith's blog post had been picked up by lwn.net.
That's very interesting. So, thanks for coming and trying out notmuch.
> Error opening
-> /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+> /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
> Too many open files
Sadly, the lwn article coincided with me having just introduced this
@@ -212,4 +212,3 @@ likes the best.
Happy hacking,
-Carl
-
diff --git a/test/encoding b/test/encoding
index 673b0394..33259c14 100755
--- a/test/encoding
+++ b/test/encoding
@@ -4,7 +4,7 @@ test_description="encoding issues"
test_begin_subtest "Message with text of unknown charset"
add_message '[content-type]="text/plain; charset=unknown-8bit"' \
- "[body]=irrelevant"
+ "[body]=irrelevant"
output=$(notmuch show id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
test_expect_equal "$output" " message{ id:msg-001@notmuch-test-suite depth:0 match:1 filename:/XXX/mail/msg-001
header{
@@ -12,7 +12,7 @@ Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox unread)
Subject: Test message #1
From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: Notmuch Test Suite <test_suite@notmuchmail.org>
-Date: Tue, 05 Jan 2001 15:43:57 -0000
+Date: Fri, 05 Jan 2001 15:43:57 +0000
header}
body{
part{ ID: 1, Content-type: text/plain
diff --git a/test/from-guessing b/test/from-guessing
index 8b69cf6c..6dfaa40a 100755
--- a/test/from-guessing
+++ b/test/from-guessing
@@ -4,10 +4,10 @@ test_description="From line heuristics (with multiple configured addresses)"
test_begin_subtest "Magic from guessing (nothing to go on)"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=mailinglist@notmuchmail.org \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="from guessing test"'
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="from guessing test"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
@@ -21,11 +21,11 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Magic from guessing (Envelope-to:)"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=mailinglist@notmuchmail.org \
- [subject]=notmuch-reply-test \
- '[header]="Envelope-To: test_suite_other@notmuchmail.org"' \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="from guessing test"'
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[header]="Envelope-To: test_suite_other@notmuchmail.org"' \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="from guessing test"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
@@ -39,11 +39,11 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Magic from guessing (X-Original-To:)"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=mailinglist@notmuchmail.org \
- [subject]=notmuch-reply-test \
- '[header]="X-Original-To: test_suite_other@notmuchmail.org"' \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="from guessing test"'
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[header]="X-Original-To: test_suite_other@notmuchmail.org"' \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="from guessing test"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
@@ -57,13 +57,13 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Magic from guessing (Received: .. for ..)"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=mailinglist@notmuchmail.org \
- [subject]=notmuch-reply-test \
- "[header]=\"Received: from mail.example.com (mail.example.com [1.1.1.1])
- by mail.notmuchmail.org (some MTA) with ESMTP id 12345678
- for <test_suite_other@notmuchmail.org>; Sat, 10 Apr 2010 07:54:51 -0400 (EDT)\"" \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="from guessing test"'
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ "[header]=\"Received: from mail.example.com (mail.example.com [1.1.1.1])
+ by mail.notmuchmail.org (some MTA) with ESMTP id 12345678
+ for <test_suite_other@notmuchmail.org>; Sat, 10 Apr 2010 07:54:51 -0400 (EDT)\"" \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="from guessing test"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
@@ -77,13 +77,13 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Magic from guessing (Received: domain)"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=mailinglist@notmuchmail.org \
- [subject]=notmuch-reply-test \
- "[header]=\"Received: from mail.example.com (mail.example.com [1.1.1.1])
- by mail.otherdomain.org (some MTA) with ESMTP id 12345678
- Sat, 10 Apr 2010 07:54:51 -0400 (EDT)\"" \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="from guessing test"'
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ "[header]=\"Received: from mail.example.com (mail.example.com [1.1.1.1])
+ by mail.otherdomain.org (some MTA) with ESMTP id 12345678
+ Sat, 10 Apr 2010 07:54:51 -0400 (EDT)\"" \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="from guessing test"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@otherdomain.org>
@@ -97,15 +97,15 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Magic from guessing (multiple Received: headers)"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=mailinglist@notmuchmail.org \
- [subject]=notmuch-reply-test \
- "[header]=\"Received: from extraneous.example.com (extraneous.example.com [1.1.1.1])
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ "[header]=\"Received: from extraneous.example.com (extraneous.example.com [1.1.1.1])
Received: from mail.example.com (mail.example.com [1.1.1.1])
- by mail.otherdomain.org (some MTA) with ESMTP id 12345678
- for <test_suite_other@notmuchmail.org>; Sat, 10 Apr 2010 07:54:51 -0400 (EDT)
+ by mail.otherdomain.org (some MTA) with ESMTP id 12345678
+ for <test_suite_other@notmuchmail.org>; Sat, 10 Apr 2010 07:54:51 -0400 (EDT)
Received: from extraneous.example.com (extraneous.example.com [1.1.1.1])\"" \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="from guessing test"'
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="from guessing test"'
output="$(notmuch reply id:${gen_msg_id})"
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
@@ -123,10 +123,10 @@ test_expect_equal '' ''
test_begin_subtest "Magic from guessing (nothing to go on)"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=mailinglist@notmuchmail.org \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="from guessing test"'
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="from guessing test"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
@@ -140,11 +140,11 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Magic from guessing (Envelope-to:)"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=mailinglist@notmuchmail.org \
- [subject]=notmuch-reply-test \
- '[header]="Envelope-To: test_suite_other@notmuchmail.org"' \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="from guessing test"'
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[header]="Envelope-To: test_suite_other@notmuchmail.org"' \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="from guessing test"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
@@ -158,11 +158,11 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Magic from guessing (X-Original-To:)"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=mailinglist@notmuchmail.org \
- [subject]=notmuch-reply-test \
- '[header]="X-Original-To: test_suite_other@notmuchmail.org"' \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="from guessing test"'
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[header]="X-Original-To: test_suite_other@notmuchmail.org"' \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="from guessing test"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
@@ -176,13 +176,13 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Magic from guessing (Received: .. for ..)"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=mailinglist@notmuchmail.org \
- [subject]=notmuch-reply-test \
- "[header]=\"Received: from mail.example.com (mail.example.com [1.1.1.1])
- by mail.notmuchmail.org (some MTA) with ESMTP id 12345678
- for <test_suite_other@notmuchmail.org>; Sat, 10 Apr 2010 07:54:51 -0400 (EDT)\"" \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="from guessing test"'
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ "[header]=\"Received: from mail.example.com (mail.example.com [1.1.1.1])
+ by mail.notmuchmail.org (some MTA) with ESMTP id 12345678
+ for <test_suite_other@notmuchmail.org>; Sat, 10 Apr 2010 07:54:51 -0400 (EDT)\"" \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="from guessing test"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
@@ -196,13 +196,13 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Magic from guessing (Received: domain)"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=mailinglist@notmuchmail.org \
- [subject]=notmuch-reply-test \
- "[header]=\"Received: from mail.example.com (mail.example.com [1.1.1.1])
- by mail.otherdomain.org (some MTA) with ESMTP id 12345678
- Sat, 10 Apr 2010 07:54:51 -0400 (EDT)\"" \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="from guessing test"'
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ "[header]=\"Received: from mail.example.com (mail.example.com [1.1.1.1])
+ by mail.otherdomain.org (some MTA) with ESMTP id 12345678
+ Sat, 10 Apr 2010 07:54:51 -0400 (EDT)\"" \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="from guessing test"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
diff --git a/test/maildir-sync b/test/maildir-sync
index a60854f8..d5872a53 100755
--- a/test/maildir-sync
+++ b/test/maildir-sync
@@ -55,8 +55,8 @@ test_expect_equal "$output" '[[[{"id": "adding-replied-tag@notmuch-test-suite",
"To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
"Cc": "",
"Bcc": "",
-"Date": "Tue,
-05 Jan 2001 15:43:57 -0000"},
+"Date": "Fri,
+05 Jan 2001 15:43:57 +0000"},
"body": [{"id": 1,
"content-type": "text/plain",
"content": "This is just a test message (#3)\n"}]},
diff --git a/test/multipart b/test/multipart
index f83526bb..2dd73f59 100755
--- a/test/multipart
+++ b/test/multipart
@@ -121,9 +121,9 @@ Date: Fri, 05 Jan 2001 15:43:57 +0000
part{ ID: 2, Content-type: multipart/mixed
part{ ID: 3, Content-type: message/rfc822
header{
+Subject: html message
From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org
-Subject: html message
Date: Fri, 05 Jan 2001 15:42:57 +0000
header}
body{
@@ -162,9 +162,9 @@ cat <<EOF >EXPECTED
part{ ID: 2, Content-type: multipart/mixed
part{ ID: 3, Content-type: message/rfc822
header{
+Subject: html message
From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org
-Subject: html message
Date: Fri, 05 Jan 2001 15:42:57 +0000
header}
body{
@@ -200,9 +200,9 @@ cat <<EOF >EXPECTED
part{ ID: 2, Content-type: multipart/mixed
part{ ID: 3, Content-type: message/rfc822
header{
+Subject: html message
From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org
-Subject: html message
Date: Fri, 05 Jan 2001 15:42:57 +0000
header}
body{
@@ -233,9 +233,9 @@ notmuch show --format=text --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OU
cat <<EOF >EXPECTED
part{ ID: 3, Content-type: message/rfc822
header{
+Subject: html message
From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org
-Subject: html message
Date: Fri, 05 Jan 2001 15:42:57 +0000
header}
body{
@@ -452,9 +452,9 @@ notmuch show --format=raw --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUT
# output should *not* include newline
echo >>OUTPUT
cat <<EOF >EXPECTED
+Subject: html message
From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org
-Subject: html message
Date: Fri, 05 Jan 2001 15:42:57 +0000
<p>This is an embedded message, with a multipart/alternative part.</p>
@@ -476,9 +476,9 @@ test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest "--format=raw --part=2, multipart/mixed"
notmuch show --format=raw --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
cat <<EOF >EXPECTED
+Subject: html message
From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org
-Subject: html message
Date: Fri, 05 Jan 2001 15:42:57 +0000
<p>This is an embedded message, with a multipart/alternative part.</p>
diff --git a/test/notmuch-test b/test/notmuch-test
index ded79e8f..e14d34e4 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -33,6 +33,7 @@ TESTS="
thread-naming
raw
reply
+ reply-to-sender
dump-restore
uuencode
thread-order
@@ -42,6 +43,7 @@ TESTS="
encoding
emacs
emacs-large-search-buffer
+ emacs-subject-to-filename
maildir-sync
crypto
symbol-hiding
@@ -50,6 +52,9 @@ TESTS="
python
hooks
argument-parsing
+ emacs-test-functions
+ emacs-address-cleaning
+ emacs-show
"
TESTS=${NOTMUCH_TESTS:=$TESTS}
diff --git a/test/python b/test/python
index c3aa7266..6018c2d0 100755
--- a/test/python
+++ b/test/python
@@ -7,11 +7,25 @@ add_email_corpus
test_begin_subtest "compare thread ids"
test_python <<EOF
import notmuch
-db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)
+db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
q_new = notmuch.Query(db, 'tag:inbox')
+q_new.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
for t in q_new.search_threads():
print t.get_thread_id()
EOF
-notmuch search --output=threads tag:inbox | sed s/^thread:// | sort > EXPECTED
-test_expect_equal_file <(sort OUTPUT) EXPECTED
+notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "compare message ids"
+test_python <<EOF
+import notmuch
+db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
+q_new = notmuch.Query(db, 'tag:inbox')
+q_new.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
+for m in q_new.search_messages():
+ print m.get_message_id()
+EOF
+notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
test_done
diff --git a/test/raw b/test/raw
index 99d3a3bf..0171e641 100755
--- a/test/raw
+++ b/test/raw
@@ -19,7 +19,7 @@ test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.or
To: Notmuch Test Suite <test_suite@notmuchmail.org>
Message-Id: <msg-001@notmuch-test-suite>
Subject: Test message #1
-Date: Tue, 05 Jan 2001 15:43:57 -0000
+Date: Fri, 05 Jan 2001 15:43:57 +0000
This is just a test message (#1)"
@@ -29,7 +29,7 @@ test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.or
To: Notmuch Test Suite <test_suite@notmuchmail.org>
Message-Id: <msg-002@notmuch-test-suite>
Subject: Test message #2
-Date: Tue, 05 Jan 2001 15:43:57 -0000
+Date: Fri, 05 Jan 2001 15:43:57 +0000
This is just a test message (#2)"
diff --git a/test/reply b/test/reply
index c0b8e261..00f4bead 100755
--- a/test/reply
+++ b/test/reply
@@ -4,10 +4,10 @@ test_description="\"notmuch reply\" in several variations"
test_begin_subtest "Basic reply"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=test_suite@notmuchmail.org \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="basic reply test"'
+ [to]=test_suite@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="basic reply test"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
@@ -21,10 +21,10 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Multiple recipients"
add_message '[from]="Sender <sender@example.com>"' \
- '[to]="test_suite@notmuchmail.org, Someone Else <someone@example.com>"' \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="Multiple recipients"'
+ '[to]="test_suite@notmuchmail.org, Someone Else <someone@example.com>"' \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="Multiple recipients"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
@@ -38,11 +38,11 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Reply with CC"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=test_suite@notmuchmail.org \
- '[cc]="Other Parties <cc@example.com>"' \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="reply with CC"'
+ [to]=test_suite@notmuchmail.org \
+ '[cc]="Other Parties <cc@example.com>"' \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="reply with CC"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
@@ -57,10 +57,10 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Reply from alternate address"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=test_suite_other@notmuchmail.org \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="reply from alternate address"'
+ [to]=test_suite_other@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="reply from alternate address"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
@@ -72,13 +72,31 @@ References: <${gen_msg_id}>
On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
> reply from alternate address"
-test_begin_subtest "Support for Reply-To"
+test_begin_subtest "Reply from address in named group list"
add_message '[from]="Sender <sender@example.com>"' \
- [to]=test_suite@notmuchmail.org \
+ '[to]=group:test_suite@notmuchmail.org,someone@example.com\;' \
+ [cc]=test_suite_other@notmuchmail.org \
[subject]=notmuch-reply-test \
'[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="support for reply-to"' \
- '[reply-to]="Sender <elsewhere@example.com>"'
+ '[body]="Reply from address in named group list"'
+
+output=$(notmuch reply id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>, someone@example.com
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> Reply from address in named group list"
+
+test_begin_subtest "Support for Reply-To"
+add_message '[from]="Sender <sender@example.com>"' \
+ [to]=test_suite@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="support for reply-to"' \
+ '[reply-to]="Sender <elsewhere@example.com>"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
@@ -92,11 +110,11 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Un-munging Reply-To"
add_message '[from]="Sender <sender@example.com>"' \
- '[to]="Some List <list@example.com>"' \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="Un-munging Reply-To"' \
- '[reply-to]="Evil Munging List <list@example.com>"'
+ '[to]="Some List <list@example.com>"' \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="Un-munging Reply-To"' \
+ '[reply-to]="Evil Munging List <list@example.com>"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
@@ -110,8 +128,8 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
test_begin_subtest "Message with header of exactly 200 bytes"
add_message '[subject]="This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces"' \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
- '[body]="200-byte header"'
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="200-byte header"'
output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
Subject: Re: This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces
diff --git a/test/reply-to-sender b/test/reply-to-sender
new file mode 100755
index 00000000..c7d15bbe
--- /dev/null
+++ b/test/reply-to-sender
@@ -0,0 +1,209 @@
+#!/usr/bin/env bash
+test_description="\"notmuch reply --reply-to=sender\" in several variations"
+. ./test-lib.sh
+
+test_begin_subtest "Basic reply-to-sender"
+add_message '[from]="Sender <sender@example.com>"' \
+ [to]=test_suite@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="basic reply-to-sender test"'
+
+output=$(notmuch reply --reply-to=sender id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> basic reply-to-sender test"
+
+test_begin_subtest "From Us, Basic reply to message"
+add_message '[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"' \
+ '[to]="Recipient <recipient@example.com>"' \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="basic reply-to-from-us test"'
+
+output=$(notmuch reply --reply-to=sender id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Recipient <recipient@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
+> basic reply-to-from-us test"
+
+test_begin_subtest "Multiple recipients"
+add_message '[from]="Sender <sender@example.com>"' \
+ '[to]="test_suite@notmuchmail.org, Someone Else <someone@example.com>"' \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="Multiple recipients"'
+
+output=$(notmuch reply --reply-to=sender id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> Multiple recipients"
+
+test_begin_subtest "From Us, Multiple TO recipients"
+add_message '[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"' \
+ '[to]="Recipient <recipient@example.com>, Someone Else <someone@example.com>"' \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="From Us, Multiple TO recipients"'
+
+output=$(notmuch reply --reply-to=sender id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Recipient <recipient@example.com>, Someone Else <someone@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
+> From Us, Multiple TO recipients"
+
+test_begin_subtest "Reply with CC"
+add_message '[from]="Sender <sender@example.com>"' \
+ [to]=test_suite@notmuchmail.org \
+ '[cc]="Other Parties <cc@example.com>"' \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="reply with CC"'
+
+output=$(notmuch reply --reply-to=sender id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> reply with CC"
+
+test_begin_subtest "From Us, Reply with CC"
+add_message '[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"' \
+ '[to]="Recipient <recipient@example.com>"' \
+ '[cc]="Other Parties <cc@example.com>"' \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="reply with CC"'
+
+output=$(notmuch reply --reply-to=sender id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Recipient <recipient@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
+> reply with CC"
+
+test_begin_subtest "From Us, Reply no TO but with CC"
+add_message '[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"' \
+ '[cc]="Other Parties <cc@example.com>"' \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="reply with CC"'
+
+output=$(notmuch reply --reply-to=sender id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+Cc: Other Parties <cc@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
+> reply with CC"
+
+test_begin_subtest "Reply from alternate address"
+add_message '[from]="Sender <sender@example.com>"' \
+ [to]=test_suite_other@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="reply from alternate address"'
+
+output=$(notmuch reply --reply-to=sender id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> reply from alternate address"
+
+test_begin_subtest "Support for Reply-To"
+add_message '[from]="Sender <sender@example.com>"' \
+ [to]=test_suite@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="support for reply-to"' \
+ '[reply-to]="Sender <elsewhere@example.com>"'
+
+output=$(notmuch reply --reply-to=sender id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <elsewhere@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> support for reply-to"
+
+test_begin_subtest "Support for Reply-To with multiple recipients"
+add_message '[from]="Sender <sender@example.com>"' \
+ '[to]="test_suite@notmuchmail.org, Someone Else <someone@example.com>"' \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="support for reply-to with multiple recipients"' \
+ '[reply-to]="Sender <elsewhere@example.com>"'
+
+output=$(notmuch reply --reply-to=sender id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <elsewhere@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> support for reply-to with multiple recipients"
+
+test_begin_subtest "Un-munging Reply-To"
+add_message '[from]="Sender <sender@example.com>"' \
+ '[to]="Some List <list@example.com>"' \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="Un-munging Reply-To"' \
+ '[reply-to]="Evil Munging List <list@example.com>"'
+
+output=$(notmuch reply --reply-to=sender id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> Un-munging Reply-To"
+
+test_begin_subtest "Message with header of exactly 200 bytes"
+add_message '[subject]="This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces"' \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="200-byte header"'
+output=$(notmuch reply --reply-to=sender id:${gen_msg_id})
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
+> 200-byte header"
+test_done
diff --git a/test/search b/test/search
index e7c8c54b..414be356 100755
--- a/test/search
+++ b/test/search
@@ -79,8 +79,11 @@ output=$(notmuch search 'subject:"subject search test (phrase)"' | notmuch_searc
test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; subject search test (phrase) (inbox unread)"
test_begin_subtest 'Search for all messages ("*")'
-output=$(notmuch search '*' | notmuch_search_sanitize)
-test_expect_equal "$output" "thread:XXX 2009-11-18 [1/1] Chris Wilson; [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox unread)
+notmuch search '*' | notmuch_search_sanitize > OUTPUT
+cat <<EOF >EXPECTED
+thread:XXX 2010-12-29 [1/1] François Boulogne; [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
+thread:XXX 2010-12-16 [1/1] Olivier Berger; Essai accentué (inbox unread)
+thread:XXX 2009-11-18 [1/1] Chris Wilson; [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox unread)
thread:XXX 2009-11-18 [2/2] Alex Botero-Lowry, Carl Worth; [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
thread:XXX 2009-11-18 [2/2] Ingmar Vanhassel, Carl Worth; [notmuch] [PATCH] Typsos (inbox unread)
thread:XXX 2009-11-18 [3/3] Adrian Perez de Castro, Keith Packard, Carl Worth; [notmuch] Introducing myself (inbox signed unread)
@@ -99,7 +102,7 @@ thread:XXX 2009-11-18 [1/1] Jan Janak; [notmuch] [PATCH] notmuch new: Support
thread:XXX 2009-11-18 [1/1] Stewart Smith; [notmuch] [PATCH] count_files: sort directory in inode order before statting (inbox unread)
thread:XXX 2009-11-18 [1/1] Stewart Smith; [notmuch] [PATCH 2/2] Read mail directory in inode number order (inbox unread)
thread:XXX 2009-11-18 [1/1] Stewart Smith; [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (inbox unread)
-thread:XXX 2009-11-18 [2/2] Lars Kellogg-Stedman; [notmuch] \"notmuch help\" outputs to stderr? (attachment inbox signed unread)
+thread:XXX 2009-11-18 [2/2] Lars Kellogg-Stedman; [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)
thread:XXX 2009-11-17 [1/1] Mikhail Gusarov; [notmuch] [PATCH] Handle rename of message file (inbox unread)
thread:XXX 2009-11-17 [2/2] Alex Botero-Lowry, Carl Worth; [notmuch] preliminary FreeBSD support (attachment inbox unread)
thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; body search (inbox unread)
@@ -117,11 +120,38 @@ thread:XXX 2000-01-01 [1/1] Search By From Name; search by from (name) (inbox
thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (address) (inbox unread)
thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)
thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; subject search test (phrase) (inbox unread)
-thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; this phrase should not match the subject search test (inbox unread)"
+thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; this phrase should not match the subject search test (inbox unread)
+EOF
+test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest "Search body (utf-8):"
add_message '[subject]="utf8-message-body-subject"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="message body utf8: bödý"'
output=$(notmuch search "bödý" | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; utf8-message-body-subject (inbox unread)"
+test_begin_subtest "Exclude \"deleted\" messages from search"
+notmuch config set search.exclude_tags = deleted
+generate_message '[subject]="Not deleted"'
+generate_message '[subject]="Deleted"'
+notmuch new > /dev/null
+notmuch tag +deleted id:$gen_msg_id
+output=$(notmuch search subject:deleted | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)"
+
+test_begin_subtest "Exclude \"deleted\" messages from search, overridden"
+output=$(notmuch search subject:deleted and tag:deleted | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Deleted (deleted inbox unread)"
+
+test_begin_subtest "Exclude \"deleted\" messages from threads"
+add_message '[subject]="Not deleted reply"' '[in-reply-to]="<$gen_msg_id>"'
+output=$(notmuch search subject:deleted | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)
+thread:XXX 2001-01-05 [1/2] Notmuch Test Suite; Not deleted reply (deleted inbox unread)"
+
+test_begin_subtest "Don't exclude \"deleted\" messages from search if not configured"
+notmuch config set search.exclude_tags
+output=$(notmuch search subject:deleted | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)
+thread:XXX 2001-01-05 [2/2] Notmuch Test Suite; Deleted (deleted inbox unread)"
+
test_done
diff --git a/test/search-output b/test/search-output
index 10291c3b..8b57a432 100755
--- a/test/search-output
+++ b/test/search-output
@@ -29,6 +29,8 @@ thread:THREADID
thread:THREADID
thread:THREADID
thread:THREADID
+thread:THREADID
+thread:THREADID
EOF
test_expect_equal_file OUTPUT EXPECTED
@@ -56,6 +58,8 @@ cat <<EOF >EXPECTED
"THREADID",
"THREADID",
"THREADID",
+"THREADID",
+"THREADID",
"THREADID"]
EOF
test_expect_equal_file OUTPUT EXPECTED
@@ -63,6 +67,8 @@ test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest "--output=messages"
notmuch search --output=messages '*' >OUTPUT
cat <<EOF >EXPECTED
+id:4EFC743A.3060609@april.org
+id:877h1wv7mg.fsf@inf-8657.int-evry.fr
id:1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk
id:877htoqdbo.fsf@yoom.home.cworth.org
id:878we4qdqf.fsf@yoom.home.cworth.org
@@ -119,7 +125,9 @@ test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest "--output=messages --format=json"
notmuch search --format=json --output=messages '*' >OUTPUT
cat <<EOF >EXPECTED
-["1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk",
+["4EFC743A.3060609@april.org",
+"877h1wv7mg.fsf@inf-8657.int-evry.fr",
+"1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk",
"877htoqdbo.fsf@yoom.home.cworth.org",
"878we4qdqf.fsf@yoom.home.cworth.org",
"87aaykqe24.fsf@yoom.home.cworth.org",
@@ -175,6 +183,8 @@ test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest "--output=files"
notmuch search --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT
cat <<EOF >EXPECTED
+MAIL_DIR/cur/52:2,
+MAIL_DIR/cur/53:2,
MAIL_DIR/cur/50:2,
MAIL_DIR/cur/49:2,
MAIL_DIR/cur/48:2,
@@ -232,7 +242,9 @@ test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest "--output=files --format=json"
notmuch search --format=json --output=files '*' | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT
cat <<EOF >EXPECTED
-["MAIL_DIR/cur/50:2,",
+["MAIL_DIR/cur/52:2,",
+"MAIL_DIR/cur/53:2,",
+"MAIL_DIR/cur/50:2,",
"MAIL_DIR/cur/49:2,",
"MAIL_DIR/cur/48:2,",
"MAIL_DIR/cur/47:2,",
diff --git a/test/search-position-overlap-bug b/test/search-position-overlap-bug
index 414b8d52..5da6ad6f 100755
--- a/test/search-position-overlap-bug
+++ b/test/search-position-overlap-bug
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Test to demonstrate a position overlap bug.
-#
+#
# At one point, notmuch would index terms incorrectly in the case of
# calling index_terms multiple times for a single field. The term
# generator was being reset to position 0 each time. This means that
@@ -12,7 +12,7 @@
# one could get a bogus match by searching for:
#
# To: a@y.c
-#
+#
# Thanks to Mark Anderson for reporting the bug, (and providing a nice,
# minimal test case that inspired what is used here), in
# id:3wd4o8wa7fx.fsf@testarossa.amd.com
diff --git a/test/symbol-hiding b/test/symbol-hiding
index 68f0d1b1..636ec917 100755
--- a/test/symbol-hiding
+++ b/test/symbol-hiding
@@ -12,7 +12,7 @@ test_description='exception symbol hiding'
. ./test-lib.sh
run_test(){
- result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib $TEST_DIRECTORY/symbol-test 2>&1)
+ result=$(LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $TEST_DIRECTORY/symbol-test 2>&1)
}
output="A Xapian exception occurred opening database: Couldn't stat 'fakedb/.notmuch/xapian'
@@ -23,7 +23,7 @@ mkdir -p fakedb/.notmuch
test_expect_success 'running test' run_test
test_begin_subtest 'checking output'
-test_expect_equal "$result" "$output"
+test_expect_equal "$result" "$output"
test_begin_subtest 'comparing existing to exported symbols'
objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == ".text" && $6 ~ "^notmuch" {print $6}' | sort | uniq > ACTUAL
diff --git a/test/test-lib.el b/test/test-lib.el
index 3b817c37..6271da22 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -20,12 +20,21 @@
;;
;; Authors: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
+(require 'cl) ;; This code is generally used uncompiled.
+
;; `read-file-name' by default uses `completing-read' function to read
;; user input. It does not respect `standard-input' variable which we
;; use in tests to provide user input. So replace it with a plain
;; `read' call.
(setq read-file-name-function (lambda (&rest _) (read)))
+;; Work around a bug in emacs 23.1 and emacs 23.2 which prevents
+;; noninteractive (kill-emacs) from emacsclient.
+(if (and (= emacs-major-version 23) (< emacs-minor-version 3))
+ (defadvice kill-emacs (before disable-yes-or-no-p activate)
+ "Disable yes-or-no-p before executing kill-emacs"
+ (defun yes-or-no-p (prompt) t)))
+
(defun notmuch-test-wait ()
"Wait for process completion."
(while (get-buffer-process (current-buffer))
@@ -42,16 +51,19 @@ FILENAME is OUTPUT."
(with-temp-file (or filename "OUTPUT") (insert text))))
(defun visible-buffer-string ()
- "Same as `buffer-string', but excludes invisible text."
+ "Same as `buffer-string', but excludes invisible text and
+removes any text properties."
(visible-buffer-substring (point-min) (point-max)))
(defun visible-buffer-substring (start end)
- "Same as `buffer-substring', but excludes invisible text."
+ "Same as `buffer-substring-no-properties', but excludes
+invisible text."
(let (str)
(while (< start end)
(let ((next-pos (next-char-property-change start end)))
(when (not (invisible-p start))
- (setq str (concat str (buffer-substring start next-pos))))
+ (setq str (concat str (buffer-substring-no-properties
+ start next-pos))))
(setq start next-pos)))
str))
@@ -76,3 +88,38 @@ nothing."
(add-hook-counter 'notmuch-hello-mode-hook)
(add-hook-counter 'notmuch-hello-refresh-hook)
+
+(defmacro notmuch-test-run (&rest body)
+ "Evaluate a BODY of test expressions and output the result."
+ `(with-temp-buffer
+ (let ((buffer (current-buffer))
+ (result (progn ,@body)))
+ (switch-to-buffer buffer)
+ (insert (if (stringp result)
+ result
+ (prin1-to-string result)))
+ (test-output))))
+
+(defun notmuch-test-report-unexpected (output expected)
+ "Report that the OUTPUT does not match the EXPECTED result."
+ (concat "Expect:\t" (prin1-to-string expected) "\n"
+ "Output:\t" (prin1-to-string output) "\n"))
+
+(defun notmuch-test-expect-equal (output expected)
+ "Compare OUTPUT with EXPECTED. Report any discrepencies."
+ (if (equal output expected)
+ t
+ (cond
+ ((and (listp output)
+ (listp expected))
+ ;; Reporting the difference between two lists is done by
+ ;; reporting differing elements of OUTPUT and EXPECTED
+ ;; pairwise. This is expected to make analysis of failures
+ ;; simpler.
+ (apply #'concat (loop for o in output
+ for e in expected
+ if (not (equal o e))
+ collect (notmuch-test-report-unexpected o e))))
+
+ (t
+ (notmuch-test-report-unexpected output expected)))))
diff --git a/test/test-lib.sh b/test/test-lib.sh
index b5e346c0..81583284 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1,4 +1,3 @@
-#!/usr/bin/env bash
#
# Copyright (c) 2005 Junio C Hamano
#
@@ -50,6 +49,7 @@ TZ=UTC
TERM=dumb
export LANG LC_ALL PAGER TERM TZ
GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}
+TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}}
# Protect ourselves from common misconfiguration to export
# CDPATH into the environment
@@ -140,7 +140,7 @@ if test -n "$color"; then
esac
shift
printf " "
- printf "$@"
+ printf "$@"
tput sgr0
print_subtest
)
@@ -150,7 +150,7 @@ else
test -z "$1" && test -n "$quiet" && return
shift
printf " "
- printf "$@"
+ printf "$@"
print_subtest
}
fi
@@ -249,7 +249,7 @@ remove_cr () {
# Store the message in file 'name'. The default is to store it
# in 'msg-<count>', where <count> is three-digit number of the
# message.
-#
+#
# [body]=text
#
# Text to use as the body of the email message
@@ -322,7 +322,7 @@ generate_message ()
fi
if [ -z "${template[date]}" ]; then
- template[date]="Tue, 05 Jan 2001 15:43:57 -0000"
+ template[date]="Fri, 05 Jan 2001 15:43:57 +0000"
fi
additional_headers=""
@@ -503,6 +503,35 @@ test_expect_equal_file ()
fi
}
+test_emacs_expect_t () {
+ test "$#" = 2 && { prereq=$1; shift; } || prereq=
+ test "$#" = 1 ||
+ error "bug in the test script: not 1 or 2 parameters to test_emacs_expect_t"
+
+ # Run the test.
+ if ! test_skip "$test_subtest_name"
+ then
+ test_emacs "(notmuch-test-run $1)" >/dev/null
+
+ # Restore state after the test.
+ exec 1>&6 2>&7 # Restore stdout and stderr
+ inside_subtest=
+
+ # Report success/failure.
+ result=$(cat OUTPUT)
+ if [ "$result" = t ]
+ then
+ test_ok_ "$test_subtest_name"
+ else
+ test_failure_ "$test_subtest_name" "${result}"
+ fi
+ else
+ # Restore state after the (non) test.
+ exec 1>&6 2>&7 # Restore stdout and stderr
+ inside_subtest=
+ fi
+}
+
NOTMUCH_NEW ()
{
notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'
@@ -869,7 +898,7 @@ test_done () {
[ -n "$EMACS_SERVER" ] && test_emacs '(kill-emacs)'
if [ "$test_failure" = "0" ]; then
- if [ "$test_broken" = "0" ]; then
+ if [ "$test_broken" = "0" ]; then
rm -rf "$remove_tmp"
fi
exit 0
@@ -881,7 +910,7 @@ test_done () {
emacs_generate_script () {
# Construct a little test script here for the benefit of the user,
# (who can easily run "run_emacs" to get the same emacs environment
- # for investigating any failures).
+ # for investigating any failures).
cat <<EOF >"$TMP_DIRECTORY/run_emacs"
#!/bin/sh
export PATH=$PATH
@@ -897,7 +926,7 @@ export NOTMUCH_CONFIG=$NOTMUCH_CONFIG
#
# --load Force loading of notmuch.el and test-lib.el
-exec emacs --no-init-file --no-site-file \
+exec ${TEST_EMACS} --no-init-file --no-site-file \
--directory "$TEST_DIRECTORY/../emacs" --load notmuch.el \
--directory "$TEST_DIRECTORY" --load test-lib.el \
"\$@"
@@ -907,8 +936,11 @@ EOF
test_emacs () {
# test dependencies beforehand to avoid the waiting loop below
- test_require_external_prereq emacs || return
- test_require_external_prereq emacsclient || return
+ missing_dependencies=
+ test_require_external_prereq dtach || missing_dependencies=1
+ test_require_external_prereq emacs || missing_dependencies=1
+ test_require_external_prereq emacsclient || missing_dependencies=1
+ test -z "$missing_dependencies" || return
if [ -z "$EMACS_SERVER" ]; then
server_name="notmuch-test-suite-$$"
@@ -923,7 +955,7 @@ test_emacs () {
--eval '(orphan-watchdog $$)'" || return
EMACS_SERVER="$server_name"
# wait until the emacs server is up
- until test_emacs '()' 2>/dev/null; do
+ until test_emacs '()' >/dev/null 2>/dev/null; do
sleep 1
done
fi
diff --git a/test/thread-naming b/test/thread-naming
index 41b97d9c..2ce92169 100755
--- a/test/thread-naming
+++ b/test/thread-naming
@@ -4,18 +4,18 @@ test_description="naming of threads with changing subject"
test_begin_subtest "Initial thread name (oldest-first search)"
add_message '[subject]="thread-naming: Initial thread subject"' \
- '[date]="Fri, 05 Jan 2001 15:43:56 -0000"'
+ '[date]="Fri, 05 Jan 2001 15:43:56 -0000"'
first=${gen_msg_cnt}
parent=${gen_msg_id}
add_message '[subject]="thread-naming: Older changed subject"' \
- '[date]="Sat, 06 Jan 2001 15:43:56 -0000"' \
- "[in-reply-to]=\<$parent\>"
+ '[date]="Sat, 06 Jan 2001 15:43:56 -0000"' \
+ "[in-reply-to]=\<$parent\>"
add_message '[subject]="thread-naming: Newer changed subject"' \
- '[date]="Sun, 07 Jan 2001 15:43:56 -0000"' \
- "[in-reply-to]=\<$parent\>"
+ '[date]="Sun, 07 Jan 2001 15:43:56 -0000"' \
+ "[in-reply-to]=\<$parent\>"
add_message '[subject]="thread-naming: Final thread subject"' \
- '[date]="Mon, 08 Jan 2001 15:43:56 -0000"' \
- "[in-reply-to]=\<$parent\>"
+ '[date]="Mon, 08 Jan 2001 15:43:56 -0000"' \
+ "[in-reply-to]=\<$parent\>"
final=${gen_msg_id}
output=$(notmuch search --sort=oldest-first thread-naming and tag:inbox | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2001-01-05 [4/4] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
@@ -37,29 +37,29 @@ test_expect_equal "$output" "thread:XXX 2001-01-07 [2/4] Notmuch Test Suite; t
test_begin_subtest "Ignore added reply prefix (Re:)"
add_message '[subject]="Re: thread-naming: Initial thread subject"' \
- '[date]="Tue, 09 Jan 2001 15:43:45 -0000"' \
- "[in-reply-to]=\<$parent\>"
+ '[date]="Tue, 09 Jan 2001 15:43:45 -0000"' \
+ "[in-reply-to]=\<$parent\>"
output=$(notmuch search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2001-01-09 [3/5] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
test_begin_subtest "Ignore added reply prefix (Aw:)"
add_message '[subject]="Aw: thread-naming: Initial thread subject"' \
- '[date]="Wed, 10 Jan 2001 15:43:45 -0000"' \
- "[in-reply-to]=\<$parent\>"
+ '[date]="Wed, 10 Jan 2001 15:43:45 -0000"' \
+ "[in-reply-to]=\<$parent\>"
output=$(notmuch search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2001-01-10 [4/6] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
test_begin_subtest "Ignore added reply prefix (Vs:)"
add_message '[subject]="Vs: thread-naming: Initial thread subject"' \
- '[date]="Thu, 11 Jan 2001 15:43:45 -0000"' \
- "[in-reply-to]=\<$parent\>"
+ '[date]="Thu, 11 Jan 2001 15:43:45 -0000"' \
+ "[in-reply-to]=\<$parent\>"
output=$(notmuch search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2001-01-11 [5/7] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
test_begin_subtest "Ignore added reply prefix (Sv:)"
add_message '[subject]="Sv: thread-naming: Initial thread subject"' \
- '[date]="Fri, 12 Jan 2001 15:43:45 -0000"' \
- "[in-reply-to]=\<$parent\>"
+ '[date]="Fri, 12 Jan 2001 15:43:45 -0000"' \
+ "[in-reply-to]=\<$parent\>"
output=$(notmuch search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2001-01-12 [6/8] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"