[PATCH 1/2] test: add modular test collections
authorJesse Rosenthal <jrosenthal@jhu.edu>
Fri, 30 Apr 2010 19:07:49 +0000 (15:07 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:37:01 +0000 (09:37 -0800)
96/1f94a091c9073ab928fecb19cb0ba5bfcdaa2e [new file with mode: 0644]

diff --git a/96/1f94a091c9073ab928fecb19cb0ba5bfcdaa2e b/96/1f94a091c9073ab928fecb19cb0ba5bfcdaa2e
new file mode 100644 (file)
index 0000000..173b332
--- /dev/null
@@ -0,0 +1,2308 @@
+Return-Path: <prvs=jrosenthal=7296245fb@jhu.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 22F854196F0\r
+       for <notmuch@notmuchmail.org>; Fri, 30 Apr 2010 12:08:00 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -4.199\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-4.199 tagged_above=-999 required=5\r
+       tests=[BAYES_00=-1.9, NORMAL_HTTP_TO_IP=0.001, RCVD_IN_DNSWL_MED=-2.3]\r
+       autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id xQ--GHEzJ4zl for <notmuch@notmuchmail.org>;\r
+       Fri, 30 Apr 2010 12:07:52 -0700 (PDT)\r
+Received: from ipex2.johnshopkins.edu (ipex2.johnshopkins.edu [162.129.8.151])\r
+       by olra.theworths.org (Postfix) with ESMTP id B4DAB431FC1\r
+       for <notmuch@notmuchmail.org>; Fri, 30 Apr 2010 12:07:51 -0700 (PDT)\r
+X-IronPort-AV: E=Sophos;i="4.52,304,1270440000"; d="scan'208";a="326232761"\r
+Received: from c-69-255-36-229.hsd1.md.comcast.net (HELO lucky)\r
+       ([69.255.36.229])\r
+       by ipex2.johnshopkins.edu with ESMTP/TLS/AES256-SHA;\r
+       30 Apr 2010 15:07:50 -0400\r
+Received: from jkr by lucky with local (Exim 4.69)\r
+       (envelope-from <jrosenthal@jhu.edu>)\r
+       id 1O7vYz-0004z2-7Y; Fri, 30 Apr 2010 15:07:49 -0400\r
+From: Jesse Rosenthal <jrosenthal@jhu.edu>\r
+To: Notmuch developer list <notmuch@notmuchmail.org>\r
+Subject: [PATCH 1/2] test: add modular test collections\r
+In-Reply-To: <87sk6cdbxz.fsf@jhu.edu>\r
+References: <87sk6cdbxz.fsf@jhu.edu>\r
+User-Agent: Notmuch/0.3-23-g5efa9bd (http://notmuchmail.org) Emacs/23.1.1\r
+       (i486-pc-linux-gnu)\r
+Date: Fri, 30 Apr 2010 15:07:49 -0400\r
+Message-ID: <87iq78daii.fsf@jhu.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 30 Apr 2010 19:08:00 -0000\r
+\r
+For the sake of modularization, add modular test collections. Each\r
+collection is a subdir of test/tests. With each dir is a series of files\r
+with the prefix "*.test" or "*.setup". The command "notmuch-test X" will\r
+run all of the files test and setup files in X, in numerical order (as\r
+determined by their numerical prefix).\r
+\r
+*.test files are the actual tests, while *.setup files are used to change\r
+to the state that the tests expect.\r
+\r
+00001-$(basename $(pwd)).setup and 99999-$(basename $(pwd)).setup are\r
+reserved for setting up for the collection and cleaning up after it. In\r
+the original monolithic test suite, certain tests required a certain state\r
+at their startup. By setting up and cleaning up for each test, we can\r
+guarantee that they do not need to be run in a specific order.\r
+\r
+The numbering system for all other tests is 00100, 00200, etc. This is\r
+designed to allow for numerous tests to be added, or added between other\r
+tests, while remaining consistent.\r
+---\r
+ .../00001-author-reordering.setup                  |    2 +\r
+ .../author-reordering/00100-adding-parent-msg.test |    4 +\r
+ .../00200-adding-initial-child-message.test        |    4 +\r
+ .../00300-adding-second-child-msg.test             |    4 +\r
+ .../00400-search-all-msgs-match.test               |    3 +\r
+ .../00500-search-two-msgs-match.test               |    3 +\r
+ .../00600-search-one-msg-matches.test              |    3 +\r
+ .../00700-search-first-msg-matches.test            |    3 +\r
+ .../99999-author-reordering.setup                  |    4 +\r
+ .../00001-from-guessing-multiple.setup             |    2 +\r
+ .../00100-nothing-to-go-on.test                    |   17 +++\r
+ .../from-guessing-multiple/00200-envelope-to.test  |   18 +++\r
+ .../00300-x-original-to.test                       |   18 +++\r
+ .../from-guessing-multiple/00400-received-for.test |   20 +++\r
+ .../00500-received-doman.test                      |   20 +++\r
+ .../99999-from-guessing-multiple.setup             |    4 +\r
+ .../00001-from-guessing-single.setup               |    4 +\r
+ .../00100-nothing-to-go-on.test                    |   17 +++\r
+ .../from-guessing-single/00200-envelope-to.test    |   18 +++\r
+ .../from-guessing-single/00300-x-original-to.test  |   18 +++\r
+ .../from-guessing-single/00400-received-for.test   |   20 +++\r
+ .../from-guessing-single/00500-received-doman.test |   20 +++\r
+ .../99999-from-guessing-single.setup               |   14 ++\r
+ test/tests/json/00001-json.setup                   |    2 +\r
+ test/tests/json/00100-show-message-json.test       |    4 +\r
+ test/tests/json/00200-search-message-json.test     |   10 ++\r
+ test/tests/json/00300-search-by-subject-utf8.test  |    4 +\r
+ test/tests/json/00400-show-message-json-utf8.test  |    4 +\r
+ .../tests/json/00500-search-message-json-utf8.test |   10 ++\r
+ test/tests/json/99999-json.setup                   |    4 +\r
+ .../00001-notmuch-dump-restore.setup               |    2 +\r
+ .../00100-dumping-all-tags.test                    |    3 +\r
+ .../00200-clearing-all-tags.test                   |    5 +\r
+ .../00300-restoring-original-tags.test             |    4 +\r
+ .../00400-restore-with-nothing.test                |    3 +\r
+ .../99999-notmuch-dump-restore.setup               |    4 +\r
+ test/tests/notmuch-new/00001-notmuch-new.setup     |    2 +\r
+ test/tests/notmuch-new/00100-no-new-mail.test      |    3 +\r
+ test/tests/notmuch-new/00200-one-new-message.test  |    4 +\r
+ .../notmuch-new/00300-multiple-new-messages.test   |    5 +\r
+ test/tests/notmuch-new/00400-non-empty-db.test     |    3 +\r
+ test/tests/notmuch-new/00500-new-directories.test  |    8 +\r
+ .../notmuch-new/00550-alternate-inode-order.test   |    9 ++\r
+ test/tests/notmuch-new/00600-message-moved.test    |   12 ++\r
+ test/tests/notmuch-new/00700-renamed-message.test  |    8 +\r
+ test/tests/notmuch-new/00800-deleted-message.test  |    6 +\r
+ .../tests/notmuch-new/00900-renamed-directory.test |   13 ++\r
+ .../tests/notmuch-new/01000-deleted-directory.test |    7 +\r
+ .../notmuch-new/01100-new-directory-end-list.test  |    8 +\r
+ .../01200-deleted-directory-end-list.test          |    7 +\r
+ .../notmuch-new/01300-new-symlink-to-dir.test      |   10 ++\r
+ .../notmuch-new/01400-new-symlink-to-file.test     |    9 ++\r
+ .../tests/notmuch-new/01500-new-two-level-dir.test |    8 +\r
+ .../notmuch-new/01600-deleted-two-level-dir.test   |    7 +\r
+ test/tests/notmuch-new/99999-notmuch-new.setup     |    4 +\r
+ test/tests/notmuch-reply/00001-notmuch-reply.setup |    2 +\r
+ test/tests/notmuch-reply/00100-basic-reply.test    |   17 +++\r
+ .../notmuch-reply/00200-multiple-recipients.test   |   17 +++\r
+ test/tests/notmuch-reply/00300-reply-with-cc.test  |   19 +++\r
+ .../00400-reply-from-alternate-address.test        |   17 +++\r
+ .../notmuch-reply/00500-support-for-reply-to.test  |   18 +++\r
+ .../notmuch-reply/00600-unmunging-reply-to.test    |   18 +++\r
+ test/tests/notmuch-reply/99999-notmuch-reply.setup |    4 +\r
+ .../notmuch-search/00001-notmuch-search.setup      |  152 ++++++++++++++++=\r
+++++\r
+ test/tests/notmuch-search/00100-search-body.test   |    4 +\r
+ .../tests/notmuch-search/00200-search-by-from.test |    4 +\r
+ test/tests/notmuch-search/00300-search-by-to.test  |    4 +\r
+ .../notmuch-search/00400-search-by-subject.test    |    4 +\r
+ test/tests/notmuch-search/00500-search-by-id.test  |    4 +\r
+ test/tests/notmuch-search/00600-search-by-tag.test |    5 +\r
+ .../notmuch-search/00700-search-by-thread.test     |    5 +\r
+ .../notmuch-search/00800-search-body-phrase.test   |    5 +\r
+ .../00900-search-by-from-address.test              |    4 +\r
+ .../notmuch-search/01000-search-by-from-name.test  |    4 +\r
+ .../notmuch-search/01100-search-by-to-address.test |    4 +\r
+ .../notmuch-search/01200-search-by-to-name.test    |    4 +\r
+ .../01300-search-by-subject-phrase.test            |    5 +\r
+ .../01400-search-for-all-messages.test             |   19 +++\r
+ .../notmuch-search/01500-search-body-utf-8.test    |    4 +\r
+ .../notmuch-search/99999-notmuch-search.setup      |    4 +\r
+ .../00001-out-of-order-threading.setup             |    2 +\r
+ .../00100-addinitial-child-message.test            |    4 +\r
+ .../00200-searching-returns-message.test           |    3 +\r
+ .../00300-adding-second-child-message.test         |    4 +\r
+ .../00400-searching-returns-both-msgs.test         |    3 +\r
+ .../00500-adding-parent-msg.test                   |    4 +\r
+ .../00600-return-all-msgs-in-one-thread.test       |    3 +\r
+ .../99999-out-of-order-threading.setup             |    4 +\r
+ test/tests/thread-naming/00001-thread-naming.setup |   17 +++\r
+ ...00-initial-thread-name-oldest-first-search.test |    3 +\r
+ ...00-initial-thread-name-newest-first-search.test |    3 +\r
+ ...00-changed-thread-name-oldest-first-search.test |    6 +\r
+ ...00-changed-thread-name-newest-first-search.test |    3 +\r
+ .../00500-ignore-added-reply-prefix-re.test        |    6 +\r
+ .../00600-ignore-added-reply-prefix-aw.test        |    6 +\r
+ .../00700-ignore-added-reply-prefix-vs.test        |    6 +\r
+ .../00800-ignore-added-reply-prefix-sv.test        |    6 +\r
+ .../00900-test-order-of-messages-in-nm-show.test   |  114 +++++++++++++++\r
+ test/tests/thread-naming/99999-thread-naming.setup |    4 +\r
+ test/tests/uuencoded/00001-uuencoded.setup         |   19 +++\r
+ .../uuencoded/00100-index-content-before-uu.test   |    3 +\r
+ test/tests/uuencoded/00200-dont-index-uu-data.test |    3 +\r
+ .../tests/uuencoded/00300-index-data-after-uu.test |    3 +\r
+ test/tests/uuencoded/99999-uuencoded.setup         |    4 +\r
+ 104 files changed, 1012 insertions(+), 0 deletions(-)\r
+ create mode 100644 test/tests/author-reordering/00001-author-reordering.se=\r
+tup\r
+ create mode 100644 test/tests/author-reordering/00100-adding-parent-msg.te=\r
+st\r
+ create mode 100644 test/tests/author-reordering/00200-adding-initial-child=\r
+-message.test\r
+ create mode 100644 test/tests/author-reordering/00300-adding-second-child-=\r
+msg.test\r
+ create mode 100644 test/tests/author-reordering/00400-search-all-msgs-matc=\r
+h.test\r
+ create mode 100644 test/tests/author-reordering/00500-search-two-msgs-matc=\r
+h.test\r
+ create mode 100644 test/tests/author-reordering/00600-search-one-msg-match=\r
+es.test\r
+ create mode 100644 test/tests/author-reordering/00700-search-first-msg-mat=\r
+ches.test\r
+ create mode 100644 test/tests/author-reordering/99999-author-reordering.se=\r
+tup\r
+ create mode 100644 test/tests/from-guessing-multiple/00001-from-guessing-m=\r
+ultiple.setup\r
+ create mode 100644 test/tests/from-guessing-multiple/00100-nothing-to-go-o=\r
+n.test\r
+ create mode 100644 test/tests/from-guessing-multiple/00200-envelope-to.test\r
+ create mode 100644 test/tests/from-guessing-multiple/00300-x-original-to.t=\r
+est\r
+ create mode 100644 test/tests/from-guessing-multiple/00400-received-for.te=\r
+st\r
+ create mode 100644 test/tests/from-guessing-multiple/00500-received-doman.=\r
+test\r
+ create mode 100644 test/tests/from-guessing-multiple/99999-from-guessing-m=\r
+ultiple.setup\r
+ create mode 100644 test/tests/from-guessing-single/00001-from-guessing-sin=\r
+gle.setup\r
+ create mode 100644 test/tests/from-guessing-single/00100-nothing-to-go-on.=\r
+test\r
+ create mode 100644 test/tests/from-guessing-single/00200-envelope-to.test\r
+ create mode 100644 test/tests/from-guessing-single/00300-x-original-to.test\r
+ create mode 100644 test/tests/from-guessing-single/00400-received-for.test\r
+ create mode 100644 test/tests/from-guessing-single/00500-received-doman.te=\r
+st\r
+ create mode 100644 test/tests/from-guessing-single/99999-from-guessing-sin=\r
+gle.setup\r
+ create mode 100644 test/tests/json/00001-json.setup\r
+ create mode 100644 test/tests/json/00100-show-message-json.test\r
+ create mode 100644 test/tests/json/00200-search-message-json.test\r
+ create mode 100644 test/tests/json/00300-search-by-subject-utf8.test\r
+ create mode 100644 test/tests/json/00400-show-message-json-utf8.test\r
+ create mode 100644 test/tests/json/00500-search-message-json-utf8.test\r
+ create mode 100644 test/tests/json/99999-json.setup\r
+ create mode 100644 test/tests/notmuch-dump-restore/00001-notmuch-dump-rest=\r
+ore.setup\r
+ create mode 100644 test/tests/notmuch-dump-restore/00100-dumping-all-tags.=\r
+test\r
+ create mode 100644 test/tests/notmuch-dump-restore/00200-clearing-all-tags=\r
+.test\r
+ create mode 100644 test/tests/notmuch-dump-restore/00300-restoring-origina=\r
+l-tags.test\r
+ create mode 100644 test/tests/notmuch-dump-restore/00400-restore-with-noth=\r
+ing.test\r
+ create mode 100644 test/tests/notmuch-dump-restore/99999-notmuch-dump-rest=\r
+ore.setup\r
+ create mode 100644 test/tests/notmuch-new/00001-notmuch-new.setup\r
+ create mode 100644 test/tests/notmuch-new/00100-no-new-mail.test\r
+ create mode 100644 test/tests/notmuch-new/00200-one-new-message.test\r
+ create mode 100644 test/tests/notmuch-new/00300-multiple-new-messages.test\r
+ create mode 100644 test/tests/notmuch-new/00400-non-empty-db.test\r
+ create mode 100644 test/tests/notmuch-new/00500-new-directories.test\r
+ create mode 100644 test/tests/notmuch-new/00550-alternate-inode-order.test\r
+ create mode 100644 test/tests/notmuch-new/00600-message-moved.test\r
+ create mode 100644 test/tests/notmuch-new/00700-renamed-message.test\r
+ create mode 100644 test/tests/notmuch-new/00800-deleted-message.test\r
+ create mode 100644 test/tests/notmuch-new/00900-renamed-directory.test\r
+ create mode 100644 test/tests/notmuch-new/01000-deleted-directory.test\r
+ create mode 100644 test/tests/notmuch-new/01100-new-directory-end-list.test\r
+ create mode 100644 test/tests/notmuch-new/01200-deleted-directory-end-list=\r
+.test\r
+ create mode 100644 test/tests/notmuch-new/01300-new-symlink-to-dir.test\r
+ create mode 100644 test/tests/notmuch-new/01400-new-symlink-to-file.test\r
+ create mode 100644 test/tests/notmuch-new/01500-new-two-level-dir.test\r
+ create mode 100644 test/tests/notmuch-new/01600-deleted-two-level-dir.test\r
+ create mode 100644 test/tests/notmuch-new/99999-notmuch-new.setup\r
+ create mode 100644 test/tests/notmuch-reply/00001-notmuch-reply.setup\r
+ create mode 100644 test/tests/notmuch-reply/00100-basic-reply.test\r
+ create mode 100644 test/tests/notmuch-reply/00200-multiple-recipients.test\r
+ create mode 100644 test/tests/notmuch-reply/00300-reply-with-cc.test\r
+ create mode 100644 test/tests/notmuch-reply/00400-reply-from-alternate-add=\r
+ress.test\r
+ create mode 100644 test/tests/notmuch-reply/00500-support-for-reply-to.test\r
+ create mode 100644 test/tests/notmuch-reply/00600-unmunging-reply-to.test\r
+ create mode 100644 test/tests/notmuch-reply/99999-notmuch-reply.setup\r
+ create mode 100644 test/tests/notmuch-search/00001-notmuch-search.setup\r
+ create mode 100644 test/tests/notmuch-search/00100-search-body.test\r
+ create mode 100644 test/tests/notmuch-search/00200-search-by-from.test\r
+ create mode 100644 test/tests/notmuch-search/00300-search-by-to.test\r
+ create mode 100644 test/tests/notmuch-search/00400-search-by-subject.test\r
+ create mode 100644 test/tests/notmuch-search/00500-search-by-id.test\r
+ create mode 100644 test/tests/notmuch-search/00600-search-by-tag.test\r
+ create mode 100644 test/tests/notmuch-search/00700-search-by-thread.test\r
+ create mode 100644 test/tests/notmuch-search/00800-search-body-phrase.test\r
+ create mode 100644 test/tests/notmuch-search/00900-search-by-from-address.=\r
+test\r
+ create mode 100644 test/tests/notmuch-search/01000-search-by-from-name.test\r
+ create mode 100644 test/tests/notmuch-search/01100-search-by-to-address.te=\r
+st\r
+ create mode 100644 test/tests/notmuch-search/01200-search-by-to-name.test\r
+ create mode 100644 test/tests/notmuch-search/01300-search-by-subject-phras=\r
+e.test\r
+ create mode 100644 test/tests/notmuch-search/01400-search-for-all-messages=\r
+.test\r
+ create mode 100644 test/tests/notmuch-search/01500-search-body-utf-8.test\r
+ create mode 100644 test/tests/notmuch-search/99999-notmuch-search.setup\r
+ create mode 100644 test/tests/out-of-order-threading/00001-out-of-order-th=\r
+reading.setup\r
+ create mode 100644 test/tests/out-of-order-threading/00100-addinitial-chil=\r
+d-message.test\r
+ create mode 100644 test/tests/out-of-order-threading/00200-searching-retur=\r
+ns-message.test\r
+ create mode 100644 test/tests/out-of-order-threading/00300-adding-second-c=\r
+hild-message.test\r
+ create mode 100644 test/tests/out-of-order-threading/00400-searching-retur=\r
+ns-both-msgs.test\r
+ create mode 100644 test/tests/out-of-order-threading/00500-adding-parent-m=\r
+sg.test\r
+ create mode 100644 test/tests/out-of-order-threading/00600-return-all-msgs=\r
+-in-one-thread.test\r
+ create mode 100644 test/tests/out-of-order-threading/99999-out-of-order-th=\r
+reading.setup\r
+ create mode 100644 test/tests/thread-naming/00001-thread-naming.setup\r
+ create mode 100644 test/tests/thread-naming/00100-initial-thread-name-olde=\r
+st-first-search.test\r
+ create mode 100644 test/tests/thread-naming/00200-initial-thread-name-newe=\r
+st-first-search.test\r
+ create mode 100644 test/tests/thread-naming/00300-changed-thread-name-olde=\r
+st-first-search.test\r
+ create mode 100644 test/tests/thread-naming/00400-changed-thread-name-newe=\r
+st-first-search.test\r
+ create mode 100644 test/tests/thread-naming/00500-ignore-added-reply-prefi=\r
+x-re.test\r
+ create mode 100644 test/tests/thread-naming/00600-ignore-added-reply-prefi=\r
+x-aw.test\r
+ create mode 100644 test/tests/thread-naming/00700-ignore-added-reply-prefi=\r
+x-vs.test\r
+ create mode 100644 test/tests/thread-naming/00800-ignore-added-reply-prefi=\r
+x-sv.test\r
+ create mode 100644 test/tests/thread-naming/00900-test-order-of-messages-i=\r
+n-nm-show.test\r
+ create mode 100644 test/tests/thread-naming/99999-thread-naming.setup\r
+ create mode 100644 test/tests/uuencoded/00001-uuencoded.setup\r
+ create mode 100644 test/tests/uuencoded/00100-index-content-before-uu.test\r
+ create mode 100644 test/tests/uuencoded/00200-dont-index-uu-data.test\r
+ create mode 100644 test/tests/uuencoded/00300-index-data-after-uu.test\r
+ create mode 100644 test/tests/uuencoded/99999-uuencoded.setup\r
+\r
+diff --git a/test/tests/author-reordering/00001-author-reordering.setup b/t=\r
+est/tests/author-reordering/00001-author-reordering.setup\r
+new file mode 100644\r
+index 0000000..46046bb\r
+--- /dev/null\r
++++ b/test/tests/author-reordering/00001-author-reordering.setup\r
+@@ -0,0 +1,2 @@\r
++printf "\nTesting author reordering;\n"\r
++printf " Setting up...\n"\r
+diff --git a/test/tests/author-reordering/00100-adding-parent-msg.test b/te=\r
+st/tests/author-reordering/00100-adding-parent-msg.test\r
+new file mode 100644\r
+index 0000000..1cb6819\r
+--- /dev/null\r
++++ b/test/tests/author-reordering/00100-adding-parent-msg.test\r
+@@ -0,0 +1,4 @@\r
++printf " Adding parent message...\t\t\t"\r
++generate_message [body]=3Dfindme [id]=3Dnew-parent-id [subject]=3Dauthor-r=\r
+eorder-threadtest '[from]=3D"User <user@example.com>"' '[date]=3D"Sat, 01 J=\r
+an 2000 12:00:00 -0000"'\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 1 new message to the database."\r
+diff --git a/test/tests/author-reordering/00200-adding-initial-child-messag=\r
+e.test b/test/tests/author-reordering/00200-adding-initial-child-message.te=\r
+st\r
+new file mode 100644\r
+index 0000000..193187b\r
+--- /dev/null\r
++++ b/test/tests/author-reordering/00200-adding-initial-child-message.test\r
+@@ -0,0 +1,4 @@\r
++printf " Adding initial child message...\t\t"\r
++generate_message [body]=3Dfindme '[in-reply-to]=3D\<new-parent-id\>' [subj=\r
+ect]=3Dauthor-reorder-threadtest '[from]=3D"User1 <user1@example.com>"' '[d=\r
+ate]=3D"Sat, 01 Jan 2000 12:00:00 -0000"'\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 1 new message to the database."\r
+diff --git a/test/tests/author-reordering/00300-adding-second-child-msg.tes=\r
+t b/test/tests/author-reordering/00300-adding-second-child-msg.test\r
+new file mode 100644\r
+index 0000000..e470776\r
+--- /dev/null\r
++++ b/test/tests/author-reordering/00300-adding-second-child-msg.test\r
+@@ -0,0 +1,4 @@\r
++printf " Adding second child message...\t\t\t"\r
++generate_message [body]=3Dfindme '[in-reply-to]=3D\<new-parent-id\>' [subj=\r
+ect]=3Dauthor-reorder-threadtest '[from]=3D"User2 <user2@example.com>"' '[d=\r
+ate]=3D"Sat, 01 Jan 2000 12:00:00 -0000"'\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 1 new message to the database."\r
+diff --git a/test/tests/author-reordering/00400-search-all-msgs-match.test =\r
+b/test/tests/author-reordering/00400-search-all-msgs-match.test\r
+new file mode 100644\r
+index 0000000..b21af06\r
+--- /dev/null\r
++++ b/test/tests/author-reordering/00400-search-all-msgs-match.test\r
+@@ -0,0 +1,3 @@\r
++printf " Searching when all three messages match...\t"\r
++output=3D$($NOTMUCH search findme | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [3/3] User, User1, User2;=\r
+ author-reorder-threadtest (inbox unread)"\r
+diff --git a/test/tests/author-reordering/00500-search-two-msgs-match.test =\r
+b/test/tests/author-reordering/00500-search-two-msgs-match.test\r
+new file mode 100644\r
+index 0000000..b879411\r
+--- /dev/null\r
++++ b/test/tests/author-reordering/00500-search-two-msgs-match.test\r
+@@ -0,0 +1,3 @@\r
++printf " Searching when two messages match...\t\t"\r
++output=3D$($NOTMUCH search User1 or User2 | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [2/3] User1, User2| User;=\r
+ author-reorder-threadtest (inbox unread)"\r
+diff --git a/test/tests/author-reordering/00600-search-one-msg-matches.test=\r
+ b/test/tests/author-reordering/00600-search-one-msg-matches.test\r
+new file mode 100644\r
+index 0000000..998cb87\r
+--- /dev/null\r
++++ b/test/tests/author-reordering/00600-search-one-msg-matches.test\r
+@@ -0,0 +1,3 @@\r
++printf " Searching when only one message matches...\t"\r
++output=3D$($NOTMUCH search User2 | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/3] User2| User, User1;=\r
+ author-reorder-threadtest (inbox unread)"\r
+diff --git a/test/tests/author-reordering/00700-search-first-msg-matches.te=\r
+st b/test/tests/author-reordering/00700-search-first-msg-matches.test\r
+new file mode 100644\r
+index 0000000..cbabdce\r
+--- /dev/null\r
++++ b/test/tests/author-reordering/00700-search-first-msg-matches.test\r
+@@ -0,0 +1,3 @@\r
++printf " Searching when only first message matches...\t"\r
++output=3D$($NOTMUCH search User | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/3] User| User1, User2;=\r
+ author-reorder-threadtest (inbox unread)"\r
+diff --git a/test/tests/author-reordering/99999-author-reordering.setup b/t=\r
+est/tests/author-reordering/99999-author-reordering.setup\r
+new file mode 100644\r
+index 0000000..ce00cfc\r
+--- /dev/null\r
++++ b/test/tests/author-reordering/99999-author-reordering.setup\r
+@@ -0,0 +1,4 @@\r
++printf " Cleaning up...\n"\r
++\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++$NOTMUCH new > /dev/null\r
+diff --git a/test/tests/from-guessing-multiple/00001-from-guessing-multiple=\r
+.setup b/test/tests/from-guessing-multiple/00001-from-guessing-multiple.set=\r
+up\r
+new file mode 100644\r
+index 0000000..f7fb7b2\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-multiple/00001-from-guessing-multiple.setup\r
+@@ -0,0 +1,2 @@\r
++printf "\nTesting From line heuristics (with multiple configured addresses=\r
+):\n"\r
++printf " Setting up...\n"\r
+diff --git a/test/tests/from-guessing-multiple/00100-nothing-to-go-on.test =\r
+b/test/tests/from-guessing-multiple/00100-nothing-to-go-on.test\r
+new file mode 100644\r
+index 0000000..e266127\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-multiple/00100-nothing-to-go-on.test\r
+@@ -0,0 +1,17 @@\r
++printf " Magic from guessing (nothing to go on)...\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dmailinglist@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"from guessing test"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.=\r
+org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> from guessing test"\r
+diff --git a/test/tests/from-guessing-multiple/00200-envelope-to.test b/tes=\r
+t/tests/from-guessing-multiple/00200-envelope-to.test\r
+new file mode 100644\r
+index 0000000..745eef1\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-multiple/00200-envelope-to.test\r
+@@ -0,0 +1,18 @@\r
++printf " Magic from guessing (Envelope-to:)...\t\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dmailinglist@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[header]=3D"Envelope-To: test_suite_other@notmuchmail.org"' \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"from guessing test"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuc=\r
+hmail.org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> from guessing test"\r
+diff --git a/test/tests/from-guessing-multiple/00300-x-original-to.test b/t=\r
+est/tests/from-guessing-multiple/00300-x-original-to.test\r
+new file mode 100644\r
+index 0000000..af1baa8\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-multiple/00300-x-original-to.test\r
+@@ -0,0 +1,18 @@\r
++printf " Magic from guessing (X-Original-To:)...\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dmailinglist@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[header]=3D"X-Original-To: test_suite_other@notmuchmail.org"'=\r
+ \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"from guessing test"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuc=\r
+hmail.org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> from guessing test"\r
+diff --git a/test/tests/from-guessing-multiple/00400-received-for.test b/te=\r
+st/tests/from-guessing-multiple/00400-received-for.test\r
+new file mode 100644\r
+index 0000000..c02f8fa\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-multiple/00400-received-for.test\r
+@@ -0,0 +1,20 @@\r
++printf " Magic from guessing (Received: .. for ..)...\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dmailinglist@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[header]=3D"Received: from mail.example.com (mail.example.com=\r
+ [1.1.1.1])\\r
++        by mail.notmuchmail.org (some MTA) with ESMTP id 12345678\\r
++        for <test_suite_other@notmuchmail.org>; Sat, 10 Apr 2010 07:54:51 =\r
+-0400 (EDT)"' \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"from guessing test"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuc=\r
+hmail.org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> from guessing test"\r
+diff --git a/test/tests/from-guessing-multiple/00500-received-doman.test b/=\r
+test/tests/from-guessing-multiple/00500-received-doman.test\r
+new file mode 100644\r
+index 0000000..f0c0abd\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-multiple/00500-received-doman.test\r
+@@ -0,0 +1,20 @@\r
++printf " Magic from guessing (Received: domain)...\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dmailinglist@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[header]=3D"Received: from mail.example.com (mail.example.com=\r
+ [1.1.1.1])\\r
++        by mail.otherdomain.org (some MTA) with ESMTP id 12345678\\r
++        Sat, 10 Apr 2010 07:54:51 -0400 (EDT)"' \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"from guessing test"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@otherdomain.=\r
+org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> from guessing test"\r
+diff --git a/test/tests/from-guessing-multiple/99999-from-guessing-multiple=\r
+.setup b/test/tests/from-guessing-multiple/99999-from-guessing-multiple.set=\r
+up\r
+new file mode 100644\r
+index 0000000..ce00cfc\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-multiple/99999-from-guessing-multiple.setup\r
+@@ -0,0 +1,4 @@\r
++printf " Cleaning up...\n"\r
++\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++$NOTMUCH new > /dev/null\r
+diff --git a/test/tests/from-guessing-single/00001-from-guessing-single.set=\r
+up b/test/tests/from-guessing-single/00001-from-guessing-single.setup\r
+new file mode 100644\r
+index 0000000..a8ac5b5\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-single/00001-from-guessing-single.setup\r
+@@ -0,0 +1,4 @@\r
++printf "\nTesting From line heuristics (with single configured address):\n"\r
++printf " Setting up...\n"\r
++\r
++sed -i -e 's/^other_email.*//' ${NOTMUCH_CONFIG}\r
+diff --git a/test/tests/from-guessing-single/00100-nothing-to-go-on.test b/=\r
+test/tests/from-guessing-single/00100-nothing-to-go-on.test\r
+new file mode 100644\r
+index 0000000..e266127\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-single/00100-nothing-to-go-on.test\r
+@@ -0,0 +1,17 @@\r
++printf " Magic from guessing (nothing to go on)...\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dmailinglist@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"from guessing test"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.=\r
+org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> from guessing test"\r
+diff --git a/test/tests/from-guessing-single/00200-envelope-to.test b/test/=\r
+tests/from-guessing-single/00200-envelope-to.test\r
+new file mode 100644\r
+index 0000000..2c3f375\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-single/00200-envelope-to.test\r
+@@ -0,0 +1,18 @@\r
++printf " Magic from guessing (Envelope-to:)...\t\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dmailinglist@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[header]=3D"Envelope-To: test_suite_other@notmuchmail.org"' \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"from guessing test"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.=\r
+org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> from guessing test"\r
+diff --git a/test/tests/from-guessing-single/00300-x-original-to.test b/tes=\r
+t/tests/from-guessing-single/00300-x-original-to.test\r
+new file mode 100644\r
+index 0000000..29906ac\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-single/00300-x-original-to.test\r
+@@ -0,0 +1,18 @@\r
++printf " Magic from guessing (X-Original-To:)...\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dmailinglist@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[header]=3D"X-Original-To: test_suite_other@notmuchmail.org"'=\r
+ \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"from guessing test"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.=\r
+org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> from guessing test"\r
+diff --git a/test/tests/from-guessing-single/00400-received-for.test b/test=\r
+/tests/from-guessing-single/00400-received-for.test\r
+new file mode 100644\r
+index 0000000..7fc4748\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-single/00400-received-for.test\r
+@@ -0,0 +1,20 @@\r
++printf " Magic from guessing (Received: .. for ..)...\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dmailinglist@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[header]=3D"Received: from mail.example.com (mail.example.com=\r
+ [1.1.1.1])\\r
++        by mail.notmuchmail.org (some MTA) with ESMTP id 12345678\\r
++        for <test_suite_other@notmuchmail.org>; Sat, 10 Apr 2010 07:54:51 =\r
+-0400 (EDT)"' \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"from guessing test"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.=\r
+org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> from guessing test"\r
+diff --git a/test/tests/from-guessing-single/00500-received-doman.test b/te=\r
+st/tests/from-guessing-single/00500-received-doman.test\r
+new file mode 100644\r
+index 0000000..bcd70f6\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-single/00500-received-doman.test\r
+@@ -0,0 +1,20 @@\r
++printf " Magic from guessing (Received: domain)...\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dmailinglist@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[header]=3D"Received: from mail.example.com (mail.example.com=\r
+ [1.1.1.1])\\r
++        by mail.otherdomain.org (some MTA) with ESMTP id 12345678\\r
++        Sat, 10 Apr 2010 07:54:51 -0400 (EDT)"' \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"from guessing test"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.=\r
+org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>, mailinglist@notmuchmail.org\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> from guessing test"\r
+diff --git a/test/tests/from-guessing-single/99999-from-guessing-single.set=\r
+up b/test/tests/from-guessing-single/99999-from-guessing-single.setup\r
+new file mode 100644\r
+index 0000000..1401d0a\r
+--- /dev/null\r
++++ b/test/tests/from-guessing-single/99999-from-guessing-single.setup\r
+@@ -0,0 +1,14 @@\r
++printf " Cleaning up...\n"\r
++\r
++cat <<EOF > ${NOTMUCH_CONFIG}\r
++[database]\r
++path=3D${MAIL_DIR}\r
++\r
++[user]\r
++name=3DNotmuch Test Suite\r
++primary_email=3Dtest_suite@notmuchmail.org\r
++other_email=3Dtest_suite_other@notmuchmail.org;test_suite@otherdomain.org\r
++EOF\r
++\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++$NOTMUCH new > /dev/null\r
+diff --git a/test/tests/json/00001-json.setup b/test/tests/json/00001-json.=\r
+setup\r
+new file mode 100644\r
+index 0000000..936fb03\r
+--- /dev/null\r
++++ b/test/tests/json/00001-json.setup\r
+@@ -0,0 +1,2 @@\r
++printf "\nTesting --format=3Djson output:\n"\r
++printf " Setting up...\n"\r
+diff --git a/test/tests/json/00100-show-message-json.test b/test/tests/json=\r
+/00100-show-message-json.test\r
+new file mode 100644\r
+index 0000000..cc6f98c\r
+--- /dev/null\r
++++ b/test/tests/json/00100-show-message-json.test\r
+@@ -0,0 +1,4 @@\r
++printf " Show message: json...\t\t\t\t"\r
++add_message '[subject]=3D"json-show-subject"' '[date]=3D"Sat, 01 Jan 2000 =\r
+12:00:00 -0000"' '[body]=3D"json-show-message"'\r
++output=3D$($NOTMUCH show --format=3Djson 'json-show-message')\r
++pass_if_equal "$output" '[[[{"id": "'${gen_msg_id}'", "match": true, "file=\r
+name": "'${gen_msg_filename}'", "timestamp": 946728000, "date_relative": "2=\r
+000-01-01", "tags": ["inbox","unread"], "headers": {"Subject": "json-show-s=\r
+ubject", "From": "Notmuch Test Suite <test_suite@notmuchmail.org>", "To": "=\r
+Notmuch Test Suite <test_suite@notmuchmail.org>", "Cc": "", "Bcc": "", "Dat=\r
+e": "Sat, 01 Jan 2000 12:00:00 -0000"}, "body": [{"id": 1, "content-type": =\r
+"text/plain", "content": "json-show-message\n"}]}, []]]]'\r
+diff --git a/test/tests/json/00200-search-message-json.test b/test/tests/js=\r
+on/00200-search-message-json.test\r
+new file mode 100644\r
+index 0000000..5a30415\r
+--- /dev/null\r
++++ b/test/tests/json/00200-search-message-json.test\r
+@@ -0,0 +1,10 @@\r
++printf " Search message: json...\t\t\t"\r
++add_message '[subject]=3D"json-search-subject"' '[date]=3D"Sat, 01 Jan 200=\r
+0 12:00:00 -0000"' '[body]=3D"json-search-message"'\r
++output=3D$($NOTMUCH search --format=3Djson 'json-search-message' | notmuch=\r
+_search_sanitize)\r
++pass_if_equal "$output" '[{"thread": "XXX",\r
++"timestamp": 946728000,\r
++"matched": 1,\r
++"total": 1,\r
++"authors": "Notmuch Test Suite",\r
++"subject": "json-search-subject",\r
++"tags": ["inbox", "unread"]}]'\r
+diff --git a/test/tests/json/00300-search-by-subject-utf8.test b/test/tests=\r
+/json/00300-search-by-subject-utf8.test\r
+new file mode 100644\r
+index 0000000..27fbb7d\r
+--- /dev/null\r
++++ b/test/tests/json/00300-search-by-subject-utf8.test\r
+@@ -0,0 +1,4 @@\r
++printf " Search by subject (utf-8):...\t\t\t"\r
++add_message [subject]=3Dutf8-s=C3=BCbj=C3=A9ct '[date]=3D"Sat, 01 Jan 2000=\r
+ 12:00:00 -0000"'\r
++output=3D$($NOTMUCH search subject:utf8-s=C3=BCbj=C3=A9ct | notmuch_search=\r
+_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ utf8-s=C3=BCbj=C3=A9ct (inbox unread)"\r
+diff --git a/test/tests/json/00400-show-message-json-utf8.test b/test/tests=\r
+/json/00400-show-message-json-utf8.test\r
+new file mode 100644\r
+index 0000000..d90f24c\r
+--- /dev/null\r
++++ b/test/tests/json/00400-show-message-json-utf8.test\r
+@@ -0,0 +1,4 @@\r
++printf " Show message: json, utf-8...\t\t\t"\r
++add_message '[subject]=3D"json-show-utf8-body-s=C3=BCbj=C3=A9ct"' '[date]=\r
+=3D"Sat, 01 Jan 2000 12:00:00 -0000"' '[body]=3D"js=C3=B6n-show-m=C3=A9ssag=\r
+e"'\r
++output=3D$($NOTMUCH show --format=3Djson 'js=C3=B6n-show-m=C3=A9ssage')\r
++pass_if_equal "$output" '[[[{"id": "'${gen_msg_id}'", "match": true, "file=\r
+name": "'${gen_msg_filename}'", "timestamp": 946728000, "date_relative": "2=\r
+000-01-01", "tags": ["inbox","unread"], "headers": {"Subject": "json-show-u=\r
+tf8-body-s=C3=BCbj=C3=A9ct", "From": "Notmuch Test Suite <test_suite@notmuc=\r
+hmail.org>", "To": "Notmuch Test Suite <test_suite@notmuchmail.org>", "Cc":=\r
+ "", "Bcc": "", "Date": "Sat, 01 Jan 2000 12:00:00 -0000"}, "body": [{"id":=\r
+ 1, "content-type": "text/plain", "content": "js=C3=B6n-show-m=C3=A9ssage\n=\r
+"}]}, []]]]'\r
+diff --git a/test/tests/json/00500-search-message-json-utf8.test b/test/tes=\r
+ts/json/00500-search-message-json-utf8.test\r
+new file mode 100644\r
+index 0000000..50a9de7\r
+--- /dev/null\r
++++ b/test/tests/json/00500-search-message-json-utf8.test\r
+@@ -0,0 +1,10 @@\r
++printf " Search message: json, utf-8...\t\t\t"\r
++add_message '[subject]=3D"json-search-utf8-body-s=C3=BCbj=C3=A9ct"' '[date=\r
+]=3D"Sat, 01 Jan 2000 12:00:00 -0000"' '[body]=3D"js=C3=B6n-search-m=C3=A9s=\r
+sage"'\r
++output=3D$($NOTMUCH search --format=3Djson 'js=C3=B6n-search-m=C3=A9ssage'=\r
+ | notmuch_search_sanitize)\r
++pass_if_equal "$output" '[{"thread": "XXX",\r
++"timestamp": 946728000,\r
++"matched": 1,\r
++"total": 1,\r
++"authors": "Notmuch Test Suite",\r
++"subject": "json-search-utf8-body-s=C3=BCbj=C3=A9ct",\r
++"tags": ["inbox", "unread"]}]'\r
+diff --git a/test/tests/json/99999-json.setup b/test/tests/json/99999-json.=\r
+setup\r
+new file mode 100644\r
+index 0000000..ce00cfc\r
+--- /dev/null\r
++++ b/test/tests/json/99999-json.setup\r
+@@ -0,0 +1,4 @@\r
++printf " Cleaning up...\n"\r
++\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++$NOTMUCH new > /dev/null\r
+diff --git a/test/tests/notmuch-dump-restore/00001-notmuch-dump-restore.set=\r
+up b/test/tests/notmuch-dump-restore/00001-notmuch-dump-restore.setup\r
+new file mode 100644\r
+index 0000000..be0e7fc\r
+--- /dev/null\r
++++ b/test/tests/notmuch-dump-restore/00001-notmuch-dump-restore.setup\r
+@@ -0,0 +1,2 @@\r
++printf "\nTesting \"notmuch dump\" and \"notmuch restore\":\n"\r
++printf " Setting up...\n"\r
+diff --git a/test/tests/notmuch-dump-restore/00100-dumping-all-tags.test b/=\r
+test/tests/notmuch-dump-restore/00100-dumping-all-tags.test\r
+new file mode 100644\r
+index 0000000..2869aee\r
+--- /dev/null\r
++++ b/test/tests/notmuch-dump-restore/00100-dumping-all-tags.test\r
+@@ -0,0 +1,3 @@\r
++printf " Dumping all tags...\t\t\t\t"\r
++$NOTMUCH dump dump.expected\r
++pass_if_equal "$?" "0"\r
+diff --git a/test/tests/notmuch-dump-restore/00200-clearing-all-tags.test b=\r
+/test/tests/notmuch-dump-restore/00200-clearing-all-tags.test\r
+new file mode 100644\r
+index 0000000..bb6b4f3\r
+--- /dev/null\r
++++ b/test/tests/notmuch-dump-restore/00200-clearing-all-tags.test\r
+@@ -0,0 +1,5 @@\r
++printf " Clearing all tags...\t\t\t\t"\r
++sed -e 's/(\([^(]*\))$/()/' < dump.expected > clear.expected\r
++$NOTMUCH restore clear.expected\r
++$NOTMUCH dump clear.actual\r
++pass_if_equal "$(< clear.actual)" "$(< clear.expected)"\r
+diff --git a/test/tests/notmuch-dump-restore/00300-restoring-original-tags.=\r
+test b/test/tests/notmuch-dump-restore/00300-restoring-original-tags.test\r
+new file mode 100644\r
+index 0000000..79702ad\r
+--- /dev/null\r
++++ b/test/tests/notmuch-dump-restore/00300-restoring-original-tags.test\r
+@@ -0,0 +1,4 @@\r
++printf " Restoring original tags...\t\t\t"\r
++$NOTMUCH restore dump.expected\r
++$NOTMUCH dump dump.actual\r
++pass_if_equal "$(< dump.actual)" "$(< dump.expected)"\r
+diff --git a/test/tests/notmuch-dump-restore/00400-restore-with-nothing.tes=\r
+t b/test/tests/notmuch-dump-restore/00400-restore-with-nothing.test\r
+new file mode 100644\r
+index 0000000..536a0eb\r
+--- /dev/null\r
++++ b/test/tests/notmuch-dump-restore/00400-restore-with-nothing.test\r
+@@ -0,0 +1,3 @@\r
++printf " Restore with nothing to do...\t\t\t"\r
++$NOTMUCH restore dump.expected\r
++pass_if_equal "$?" "0"\r
+diff --git a/test/tests/notmuch-dump-restore/99999-notmuch-dump-restore.set=\r
+up b/test/tests/notmuch-dump-restore/99999-notmuch-dump-restore.setup\r
+new file mode 100644\r
+index 0000000..ce00cfc\r
+--- /dev/null\r
++++ b/test/tests/notmuch-dump-restore/99999-notmuch-dump-restore.setup\r
+@@ -0,0 +1,4 @@\r
++printf " Cleaning up...\n"\r
++\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++$NOTMUCH new > /dev/null\r
+diff --git a/test/tests/notmuch-new/00001-notmuch-new.setup b/test/tests/no=\r
+tmuch-new/00001-notmuch-new.setup\r
+new file mode 100644\r
+index 0000000..9415160\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/00001-notmuch-new.setup\r
+@@ -0,0 +1,2 @@\r
++printf "Testing \"notmuch new\" in several variations:\n"\r
++printf " Setting up...\n"\r
+diff --git a/test/tests/notmuch-new/00100-no-new-mail.test b/test/tests/not=\r
+much-new/00100-no-new-mail.test\r
+new file mode 100644\r
+index 0000000..e7c646d\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/00100-no-new-mail.test\r
+@@ -0,0 +1,3 @@\r
++printf " No new messages...\t\t\t\t"\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "No new mail."\r
+diff --git a/test/tests/notmuch-new/00200-one-new-message.test b/test/tests=\r
+/notmuch-new/00200-one-new-message.test\r
+new file mode 100644\r
+index 0000000..6a0af76\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/00200-one-new-message.test\r
+@@ -0,0 +1,4 @@\r
++printf " Single new message...\t\t\t\t"\r
++generate_message\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 1 new message to the database."\r
+diff --git a/test/tests/notmuch-new/00300-multiple-new-messages.test b/test=\r
+/tests/notmuch-new/00300-multiple-new-messages.test\r
+new file mode 100644\r
+index 0000000..f13bf19\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/00300-multiple-new-messages.test\r
+@@ -0,0 +1,5 @@\r
++printf " Multiple new messages...\t\t\t"\r
++generate_message\r
++generate_message\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 2 new messages to the database."\r
+diff --git a/test/tests/notmuch-new/00400-non-empty-db.test b/test/tests/no=\r
+tmuch-new/00400-non-empty-db.test\r
+new file mode 100644\r
+index 0000000..92b2fb8\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/00400-non-empty-db.test\r
+@@ -0,0 +1,3 @@\r
++printf " No new messages (non-empty DB)...\t\t"\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "No new mail."\r
+diff --git a/test/tests/notmuch-new/00500-new-directories.test b/test/tests=\r
+/notmuch-new/00500-new-directories.test\r
+new file mode 100644\r
+index 0000000..c123c8f\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/00500-new-directories.test\r
+@@ -0,0 +1,8 @@\r
++printf " New directories...\t\t\t\t"\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++mkdir ${MAIL_DIR}/def\r
++mkdir ${MAIL_DIR}/ghi\r
++generate_message [dir]=3Ddef\r
++\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 1 new message to the database."\r
+diff --git a/test/tests/notmuch-new/00550-alternate-inode-order.test b/test=\r
+/tests/notmuch-new/00550-alternate-inode-order.test\r
+new file mode 100644\r
+index 0000000..448fcdf\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/00550-alternate-inode-order.test\r
+@@ -0,0 +1,9 @@\r
++printf " Alternate inode order...\t\t\t"\r
++\r
++rm -rf ${MAIL_DIR}/.notmuch\r
++mv ${MAIL_DIR}/ghi ${MAIL_DIR}/abc\r
++rm ${MAIL_DIR}/def/*\r
++generate_message [dir]=3Dabc\r
++\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 1 new message to the database."\r
+diff --git a/test/tests/notmuch-new/00600-message-moved.test b/test/tests/n=\r
+otmuch-new/00600-message-moved.test\r
+new file mode 100644\r
+index 0000000..5bae2af\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/00600-message-moved.test\r
+@@ -0,0 +1,12 @@\r
++printf " Message moved in...\t\t\t\t"\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++generate_message\r
++tmp_msg_filename=3Dtmp/$gen_msg_filename\r
++mkdir -p $(dirname $tmp_msg_filename)\r
++mv $gen_msg_filename $tmp_msg_filename\r
++increment_mtime ${MAIL_DIR}\r
++$NOTMUCH new > /dev/null\r
++mv $tmp_msg_filename $gen_msg_filename\r
++increment_mtime ${MAIL_DIR}\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 1 new message to the database."\r
+diff --git a/test/tests/notmuch-new/00700-renamed-message.test b/test/tests=\r
+/notmuch-new/00700-renamed-message.test\r
+new file mode 100644\r
+index 0000000..a774d79\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/00700-renamed-message.test\r
+@@ -0,0 +1,8 @@\r
++printf " Renamed message...\t\t\t\t"\r
++\r
++generate_message\r
++$NOTMUCH new > /dev/null\r
++mv $gen_msg_filename ${gen_msg_filename}-renamed\r
++increment_mtime ${MAIL_DIR}\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "No new mail. Detected 1 file rename."\r
+diff --git a/test/tests/notmuch-new/00800-deleted-message.test b/test/tests=\r
+/notmuch-new/00800-deleted-message.test\r
+new file mode 100644\r
+index 0000000..7f1a280\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/00800-deleted-message.test\r
+@@ -0,0 +1,6 @@\r
++printf " Deleted message...\t\t\t\t"\r
++\r
++rm ${gen_msg_filename}-renamed\r
++increment_mtime ${MAIL_DIR}\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "No new mail. Removed 1 message."\r
+diff --git a/test/tests/notmuch-new/00900-renamed-directory.test b/test/tes=\r
+ts/notmuch-new/00900-renamed-directory.test\r
+new file mode 100644\r
+index 0000000..64e587a\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/00900-renamed-directory.test\r
+@@ -0,0 +1,13 @@\r
++printf " Renamed directory...\t\t\t\t"\r
++\r
++generate_message [dir]=3Ddir\r
++generate_message [dir]=3Ddir\r
++generate_message [dir]=3Ddir\r
++\r
++$NOTMUCH new > /dev/null\r
++\r
++mv ${MAIL_DIR}/dir ${MAIL_DIR}/dir-renamed\r
++increment_mtime ${MAIL_DIR}\r
++\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "No new mail. Detected 3 file renames."\r
+diff --git a/test/tests/notmuch-new/01000-deleted-directory.test b/test/tes=\r
+ts/notmuch-new/01000-deleted-directory.test\r
+new file mode 100644\r
+index 0000000..1808840\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/01000-deleted-directory.test\r
+@@ -0,0 +1,7 @@\r
++printf " Deleted directory...\t\t\t\t"\r
++\r
++rm -rf ${MAIL_DIR}/dir-renamed\r
++increment_mtime ${MAIL_DIR}\r
++\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "No new mail. Removed 3 messages."\r
+diff --git a/test/tests/notmuch-new/01100-new-directory-end-list.test b/tes=\r
+t/tests/notmuch-new/01100-new-directory-end-list.test\r
+new file mode 100644\r
+index 0000000..741fb83\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/01100-new-directory-end-list.test\r
+@@ -0,0 +1,8 @@\r
++printf " New directory (at end of list)...\t\t"\r
++\r
++generate_message [dir]=3Dzzz\r
++generate_message [dir]=3Dzzz\r
++generate_message [dir]=3Dzzz\r
++\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 3 new messages to the database."\r
+diff --git a/test/tests/notmuch-new/01200-deleted-directory-end-list.test b=\r
+/test/tests/notmuch-new/01200-deleted-directory-end-list.test\r
+new file mode 100644\r
+index 0000000..ee59bfd\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/01200-deleted-directory-end-list.test\r
+@@ -0,0 +1,7 @@\r
++printf " Deleted directory (end of list)...\t\t"\r
++\r
++rm -rf ${MAIL_DIR}/zzz\r
++increment_mtime ${MAIL_DIR}\r
++\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "No new mail. Removed 3 messages."\r
+diff --git a/test/tests/notmuch-new/01300-new-symlink-to-dir.test b/test/te=\r
+sts/notmuch-new/01300-new-symlink-to-dir.test\r
+new file mode 100644\r
+index 0000000..ffcdfa4\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/01300-new-symlink-to-dir.test\r
+@@ -0,0 +1,10 @@\r
++printf " New symlink to directory...\t\t\t"\r
++\r
++rm -rf ${MAIL_DIR}/.notmuch\r
++mv ${MAIL_DIR} ${TEST_DIR}/actual_maildir\r
++\r
++mkdir ${MAIL_DIR}\r
++ln -s ${TEST_DIR}/actual_maildir ${MAIL_DIR}/symlink\r
++\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 1 new message to the database."\r
+diff --git a/test/tests/notmuch-new/01400-new-symlink-to-file.test b/test/t=\r
+ests/notmuch-new/01400-new-symlink-to-file.test\r
+new file mode 100644\r
+index 0000000..e2ac273\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/01400-new-symlink-to-file.test\r
+@@ -0,0 +1,9 @@\r
++printf " New symlink to a file...\t\t\t"\r
++generate_message\r
++external_msg_filename=3D${TEST_DIR}/external/$(basename $gen_msg_filename)\r
++mkdir -p $(dirname $external_msg_filename)\r
++mv $gen_msg_filename $external_msg_filename\r
++ln -s $external_msg_filename $gen_msg_filename\r
++increment_mtime ${MAIL_DIR}\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 1 new message to the database."\r
+diff --git a/test/tests/notmuch-new/01500-new-two-level-dir.test b/test/tes=\r
+ts/notmuch-new/01500-new-two-level-dir.test\r
+new file mode 100644\r
+index 0000000..30c0bbb\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/01500-new-two-level-dir.test\r
+@@ -0,0 +1,8 @@\r
++printf " New two-level directory...\t\t\t"\r
++\r
++generate_message [dir]=3Dtwo/levels\r
++generate_message [dir]=3Dtwo/levels\r
++generate_message [dir]=3Dtwo/levels\r
++\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 3 new messages to the database."\r
+diff --git a/test/tests/notmuch-new/01600-deleted-two-level-dir.test b/test=\r
+/tests/notmuch-new/01600-deleted-two-level-dir.test\r
+new file mode 100644\r
+index 0000000..8958b8a\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/01600-deleted-two-level-dir.test\r
+@@ -0,0 +1,7 @@\r
++printf " Deleted two-level directory...\t\t\t"\r
++\r
++rm -rf ${MAIL_DIR}/two\r
++increment_mtime ${MAIL_DIR}\r
++\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "No new mail. Removed 3 messages."\r
+diff --git a/test/tests/notmuch-new/99999-notmuch-new.setup b/test/tests/no=\r
+tmuch-new/99999-notmuch-new.setup\r
+new file mode 100644\r
+index 0000000..ce00cfc\r
+--- /dev/null\r
++++ b/test/tests/notmuch-new/99999-notmuch-new.setup\r
+@@ -0,0 +1,4 @@\r
++printf " Cleaning up...\n"\r
++\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++$NOTMUCH new > /dev/null\r
+diff --git a/test/tests/notmuch-reply/00001-notmuch-reply.setup b/test/test=\r
+s/notmuch-reply/00001-notmuch-reply.setup\r
+new file mode 100644\r
+index 0000000..48ab355\r
+--- /dev/null\r
++++ b/test/tests/notmuch-reply/00001-notmuch-reply.setup\r
+@@ -0,0 +1,2 @@\r
++printf "\nTesting \"notmuch reply\" in several variations:\n"\r
++printf " Setting up...\n"\r
+diff --git a/test/tests/notmuch-reply/00100-basic-reply.test b/test/tests/n=\r
+otmuch-reply/00100-basic-reply.test\r
+new file mode 100644\r
+index 0000000..12f8d76\r
+--- /dev/null\r
++++ b/test/tests/notmuch-reply/00100-basic-reply.test\r
+@@ -0,0 +1,17 @@\r
++printf " Basic reply...\t\t\t\t\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dtest_suite@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"basic reply test"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.=\r
+org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> basic reply test"\r
+diff --git a/test/tests/notmuch-reply/00200-multiple-recipients.test b/test=\r
+/tests/notmuch-reply/00200-multiple-recipients.test\r
+new file mode 100644\r
+index 0000000..f0846dc\r
+--- /dev/null\r
++++ b/test/tests/notmuch-reply/00200-multiple-recipients.test\r
+@@ -0,0 +1,17 @@\r
++printf " Multiple recipients...\t\t\t\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++            '[to]=3D"test_suite@notmuchmail.org, Someone Else <someone@exa=\r
+mple.com>"' \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"Multiple recipients"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.=\r
+org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>, Someone Else <someone@example.com>\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> Multiple recipients"\r
+diff --git a/test/tests/notmuch-reply/00300-reply-with-cc.test b/test/tests=\r
+/notmuch-reply/00300-reply-with-cc.test\r
+new file mode 100644\r
+index 0000000..904958f\r
+--- /dev/null\r
++++ b/test/tests/notmuch-reply/00300-reply-with-cc.test\r
+@@ -0,0 +1,19 @@\r
++printf " Reply with CC...\t\t\t\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dtest_suite@notmuchmail.org \\r
++            '[cc]=3D"Other Parties <cc@example.com>"' \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"reply with CC"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.=\r
+org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>\r
++Cc: Other Parties <cc@example.com>\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> reply with CC"\r
+diff --git a/test/tests/notmuch-reply/00400-reply-from-alternate-address.te=\r
+st b/test/tests/notmuch-reply/00400-reply-from-alternate-address.test\r
+new file mode 100644\r
+index 0000000..77848f3\r
+--- /dev/null\r
++++ b/test/tests/notmuch-reply/00400-reply-from-alternate-address.test\r
+@@ -0,0 +1,17 @@\r
++printf " Reply from alternate address...\t\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dtest_suite_other@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"reply from alternate address"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuc=\r
+hmail.org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> reply from alternate address"\r
+diff --git a/test/tests/notmuch-reply/00500-support-for-reply-to.test b/tes=\r
+t/tests/notmuch-reply/00500-support-for-reply-to.test\r
+new file mode 100644\r
+index 0000000..9194c7a\r
+--- /dev/null\r
++++ b/test/tests/notmuch-reply/00500-support-for-reply-to.test\r
+@@ -0,0 +1,18 @@\r
++printf " Support for Reply-To...\t\t\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++             [to]=3Dtest_suite@notmuchmail.org \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"support for reply-to"' \\r
++            '[reply-to]=3D"Sender <elsewhere@example.com>"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.=\r
+org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <elsewhere@example.com>\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> support for reply-to"\r
+diff --git a/test/tests/notmuch-reply/00600-unmunging-reply-to.test b/test/=\r
+tests/notmuch-reply/00600-unmunging-reply-to.test\r
+new file mode 100644\r
+index 0000000..b470f65\r
+--- /dev/null\r
++++ b/test/tests/notmuch-reply/00600-unmunging-reply-to.test\r
+@@ -0,0 +1,18 @@\r
++printf " Un-munging Reply-To...\t\t\t\t"\r
++add_message '[from]=3D"Sender <sender@example.com>"' \\r
++            '[to]=3D"Some List <list@example.com>"' \\r
++             [subject]=3Dnotmuch-reply-test \\r
++            '[date]=3D"Tue, 05 Jan 2010 15:43:56 -0800"' \\r
++            '[body]=3D"Un-munging Reply-To"' \\r
++            '[reply-to]=3D"Evil Munging List <list@example.com>"'\r
++\r
++output=3D$($NOTMUCH reply id:${gen_msg_id})\r
++pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.=\r
+org>\r
++Subject: Re: notmuch-reply-test\r
++To: Sender <sender@example.com>, Some List <list@example.com>\r
++Bcc: test_suite@notmuchmail.org\r
++In-Reply-To: <${gen_msg_id}>\r
++References: <${gen_msg_id}>\r
++\r
++On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:\r
++> Un-munging Reply-To"\r
+diff --git a/test/tests/notmuch-reply/99999-notmuch-reply.setup b/test/test=\r
+s/notmuch-reply/99999-notmuch-reply.setup\r
+new file mode 100644\r
+index 0000000..ce00cfc\r
+--- /dev/null\r
++++ b/test/tests/notmuch-reply/99999-notmuch-reply.setup\r
+@@ -0,0 +1,4 @@\r
++printf " Cleaning up...\n"\r
++\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++$NOTMUCH new > /dev/null\r
+diff --git a/test/tests/notmuch-search/00001-notmuch-search.setup b/test/te=\r
+sts/notmuch-search/00001-notmuch-search.setup\r
+new file mode 100644\r
+index 0000000..5afd7ec\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/00001-notmuch-search.setup\r
+@@ -0,0 +1,152 @@\r
++printf "\nTesting \"notmuch search\" in several variations:\n"\r
++\r
++# printf "Testing \"notmuch new\" in several variations:\n"\r
++# printf " No new messages...\t\t\t\t"\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "No new mail."\r
++\r
++printf " Setting up...\n"\r
++\r
++gen_msg_cnt=3D0\r
++gen_msg_filename=3D""\r
++gen_msg_id=3D""\r
++\r
++# printf " Single new message...\t\t\t\t"\r
++generate_message\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "Added 1 new message to the database."\r
++\r
++# printf " Multiple new messages...\t\t\t"\r
++generate_message\r
++generate_message\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "Added 2 new messages to the database."\r
++\r
++# printf " No new messages (non-empty DB)...\t\t"\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "No new mail."\r
++\r
++# printf " New directories...\t\t\t\t"\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++mkdir ${MAIL_DIR}/def\r
++mkdir ${MAIL_DIR}/ghi\r
++generate_message [dir]=3Ddef\r
++\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "Added 1 new message to the database."\r
++\r
++# printf " Alternate inode order...\t\t\t"\r
++\r
++rm -rf ${MAIL_DIR}/.notmuch\r
++mv ${MAIL_DIR}/ghi ${MAIL_DIR}/abc\r
++rm ${MAIL_DIR}/def/*\r
++generate_message [dir]=3Dabc\r
++\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "Added 1 new message to the database."\r
++\r
++# printf " Message moved in...\t\t\t\t"\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++generate_message\r
++tmp_msg_filename=3Dtmp/$gen_msg_filename\r
++mkdir -p $(dirname $tmp_msg_filename)\r
++mv $gen_msg_filename $tmp_msg_filename\r
++increment_mtime ${MAIL_DIR}\r
++$NOTMUCH new > /dev/null\r
++mv $tmp_msg_filename $gen_msg_filename\r
++increment_mtime ${MAIL_DIR}\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "Added 1 new message to the database."\r
++\r
++# printf " Renamed message...\t\t\t\t"\r
++\r
++generate_message\r
++$NOTMUCH new > /dev/null\r
++mv $gen_msg_filename ${gen_msg_filename}-renamed\r
++increment_mtime ${MAIL_DIR}\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "No new mail. Detected 1 file rename."\r
++\r
++# printf " Deleted message...\t\t\t\t"\r
++\r
++rm ${gen_msg_filename}-renamed\r
++increment_mtime ${MAIL_DIR}\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "No new mail. Removed 1 message."\r
++\r
++# printf " Renamed directory...\t\t\t\t"\r
++\r
++generate_message [dir]=3Ddir\r
++generate_message [dir]=3Ddir\r
++generate_message [dir]=3Ddir\r
++\r
++$NOTMUCH new > /dev/null\r
++\r
++mv ${MAIL_DIR}/dir ${MAIL_DIR}/dir-renamed\r
++increment_mtime ${MAIL_DIR}\r
++\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "No new mail. Detected 3 file renames."\r
++\r
++# printf " Deleted directory...\t\t\t\t"\r
++\r
++rm -rf ${MAIL_DIR}/dir-renamed\r
++increment_mtime ${MAIL_DIR}\r
++\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "No new mail. Removed 3 messages."\r
++\r
++# printf " New directory (at end of list)...\t\t"\r
++\r
++generate_message [dir]=3Dzzz\r
++generate_message [dir]=3Dzzz\r
++generate_message [dir]=3Dzzz\r
++\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "Added 3 new messages to the database."\r
++\r
++# printf " Deleted directory (end of list)...\t\t"\r
++\r
++rm -rf ${MAIL_DIR}/zzz\r
++increment_mtime ${MAIL_DIR}\r
++\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "No new mail. Removed 3 messages."\r
++\r
++# printf " New symlink to directory...\t\t\t"\r
++\r
++rm -rf ${MAIL_DIR}/.notmuch\r
++mv ${MAIL_DIR} ${TEST_DIR}/actual_maildir\r
++\r
++mkdir ${MAIL_DIR}\r
++ln -s ${TEST_DIR}/actual_maildir ${MAIL_DIR}/symlink\r
++\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "Added 1 new message to the database."\r
++\r
++# printf " New symlink to a file...\t\t\t"\r
++generate_message\r
++external_msg_filename=3D${TEST_DIR}/external/$(basename $gen_msg_filename)\r
++mkdir -p $(dirname $external_msg_filename)\r
++mv $gen_msg_filename $external_msg_filename\r
++ln -s $external_msg_filename $gen_msg_filename\r
++increment_mtime ${MAIL_DIR}\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "Added 1 new message to the database."\r
++\r
++# printf " New two-level directory...\t\t\t"\r
++\r
++generate_message [dir]=3Dtwo/levels\r
++generate_message [dir]=3Dtwo/levels\r
++generate_message [dir]=3Dtwo/levels\r
++\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "Added 3 new messages to the database."\r
++\r
++# printf " Deleted two-level directory...\t\t\t"\r
++\r
++rm -rf ${MAIL_DIR}/two\r
++increment_mtime ${MAIL_DIR}\r
++\r
++# output=3D$(NOTMUCH_NEW)\r
++# pass_if_equal "$output" "No new mail. Removed 3 messages."\r
+diff --git a/test/tests/notmuch-search/00100-search-body.test b/test/tests/=\r
+notmuch-search/00100-search-body.test\r
+new file mode 100644\r
+index 0000000..a50d2e4\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/00100-search-body.test\r
+@@ -0,0 +1,4 @@\r
++printf " Search body...\t\t\t\t\t"\r
++add_message '[subject]=3D"body search"' '[date]=3D"Sat, 01 Jan 2000 12:00:=\r
+00 -0000"' [body]=3Dbodysearchtest\r
++output=3D$($NOTMUCH search bodysearchtest | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ body search (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/00200-search-by-from.test b/test/tes=\r
+ts/notmuch-search/00200-search-by-from.test\r
+new file mode 100644\r
+index 0000000..f4944d2\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/00200-search-by-from.test\r
+@@ -0,0 +1,4 @@\r
++printf " Search by from:...\t\t\t\t"\r
++add_message '[subject]=3D"search by from"' '[date]=3D"Sat, 01 Jan 2000 12:=\r
+00:00 -0000"' [from]=3Dsearchbyfrom\r
++output=3D$($NOTMUCH search from:searchbyfrom | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] searchbyfrom; searc=\r
+h by from (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/00300-search-by-to.test b/test/tests=\r
+/notmuch-search/00300-search-by-to.test\r
+new file mode 100644\r
+index 0000000..fa9c9af\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/00300-search-by-to.test\r
+@@ -0,0 +1,4 @@\r
++printf " Search by to:...\t\t\t\t"\r
++add_message '[subject]=3D"search by to"' '[date]=3D"Sat, 01 Jan 2000 12:00=\r
+:00 -0000"' [to]=3Dsearchbyto\r
++output=3D$($NOTMUCH search to:searchbyto | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ search by to (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/00400-search-by-subject.test b/test/=\r
+tests/notmuch-search/00400-search-by-subject.test\r
+new file mode 100644\r
+index 0000000..ea8d98a\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/00400-search-by-subject.test\r
+@@ -0,0 +1,4 @@\r
++printf " Search by subject:...\t\t\t\t"\r
++add_message [subject]=3Dsubjectsearchtest '[date]=3D"Sat, 01 Jan 2000 12:0=\r
+0:00 -0000"'\r
++output=3D$($NOTMUCH search subject:subjectsearchtest | notmuch_search_sani=\r
+tize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ subjectsearchtest (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/00500-search-by-id.test b/test/tests=\r
+/notmuch-search/00500-search-by-id.test\r
+new file mode 100644\r
+index 0000000..4e3a06e\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/00500-search-by-id.test\r
+@@ -0,0 +1,4 @@\r
++printf " Search by id:...\t\t\t\t"\r
++add_message '[subject]=3D"search by id"' '[date]=3D"Sat, 01 Jan 2000 12:00=\r
+:00 -0000"'\r
++output=3D$($NOTMUCH search id:${gen_msg_id} | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ search by id (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/00600-search-by-tag.test b/test/test=\r
+s/notmuch-search/00600-search-by-tag.test\r
+new file mode 100644\r
+index 0000000..2af2d69\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/00600-search-by-tag.test\r
+@@ -0,0 +1,5 @@\r
++printf " Search by tag:...\t\t\t\t"\r
++add_message '[subject]=3D"search by tag"' '[date]=3D"Sat, 01 Jan 2000 12:0=\r
+0:00 -0000"'\r
++$NOTMUCH tag +searchbytag id:${gen_msg_id}\r
++output=3D$($NOTMUCH search tag:searchbytag | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ search by tag (inbox searchbytag unread)"\r
+diff --git a/test/tests/notmuch-search/00700-search-by-thread.test b/test/t=\r
+ests/notmuch-search/00700-search-by-thread.test\r
+new file mode 100644\r
+index 0000000..9196cbd\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/00700-search-by-thread.test\r
+@@ -0,0 +1,5 @@\r
++printf " Search by thread:...\t\t\t\t"\r
++add_message '[subject]=3D"search by thread"' '[date]=3D"Sat, 01 Jan 2000 1=\r
+2:00:00 -0000"'\r
++thread_id=3D$($NOTMUCH search id:${gen_msg_id} | sed -e 's/thread:\([a-f0-=\r
+9]*\).*/\1/')\r
++output=3D$($NOTMUCH search thread:${thread_id} | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ search by thread (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/00800-search-body-phrase.test b/test=\r
+/tests/notmuch-search/00800-search-body-phrase.test\r
+new file mode 100644\r
+index 0000000..687bf1d\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/00800-search-body-phrase.test\r
+@@ -0,0 +1,5 @@\r
++printf " Search body (phrase)...\t\t\t"\r
++add_message '[subject]=3D"body search (phrase)"' '[date]=3D"Sat, 01 Jan 20=\r
+00 12:00:00 -0000"' '[body]=3D"body search (phrase)"'\r
++add_message '[subject]=3D"negative result"' '[date]=3D"Sat, 01 Jan 2000 12=\r
+:00:00 -0000"' '[body]=3D"This phrase should not match the body search"'\r
++output=3D$($NOTMUCH search '\"body search (phrase)\"' | notmuch_search_san=\r
+itize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ body search (phrase) (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/00900-search-by-from-address.test b/=\r
+test/tests/notmuch-search/00900-search-by-from-address.test\r
+new file mode 100644\r
+index 0000000..a21c336\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/00900-search-by-from-address.test\r
+@@ -0,0 +1,4 @@\r
++printf " Search by from: (address)...\t\t\t"\r
++add_message '[subject]=3D"search by from (address)"' '[date]=3D"Sat, 01 Ja=\r
+n 2000 12:00:00 -0000"' [from]=3Dsearchbyfrom@example.com\r
++output=3D$($NOTMUCH search from:searchbyfrom@example.com | notmuch_search_=\r
+sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] searchbyfrom@exampl=\r
+e.com; search by from (address) (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/01000-search-by-from-name.test b/tes=\r
+t/tests/notmuch-search/01000-search-by-from-name.test\r
+new file mode 100644\r
+index 0000000..2db7078\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/01000-search-by-from-name.test\r
+@@ -0,0 +1,4 @@\r
++printf " Search by from: (name)...\t\t\t"\r
++add_message '[subject]=3D"search by from (name)"' '[date]=3D"Sat, 01 Jan 2=\r
+000 12:00:00 -0000"' '[from]=3D"Search By From Name <test@example.com>"'\r
++output=3D$($NOTMUCH search from:'Search By From Name' | notmuch_search_san=\r
+itize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Search By From Name=\r
+; search by from (name) (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/01100-search-by-to-address.test b/te=\r
+st/tests/notmuch-search/01100-search-by-to-address.test\r
+new file mode 100644\r
+index 0000000..514ecaf\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/01100-search-by-to-address.test\r
+@@ -0,0 +1,4 @@\r
++printf " Search by to: (address)...\t\t\t"\r
++add_message '[subject]=3D"search by to (address)"' '[date]=3D"Sat, 01 Jan =\r
+2000 12:00:00 -0000"' [to]=3Dsearchbyto@example.com\r
++output=3D$($NOTMUCH search to:searchbyto@example.com | notmuch_search_sani=\r
+tize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ search by to (address) (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/01200-search-by-to-name.test b/test/=\r
+tests/notmuch-search/01200-search-by-to-name.test\r
+new file mode 100644\r
+index 0000000..3069a79\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/01200-search-by-to-name.test\r
+@@ -0,0 +1,4 @@\r
++printf " Search by to: (name)...\t\t\t"\r
++add_message '[subject]=3D"search by to (name)"' '[date]=3D"Sat, 01 Jan 200=\r
+0 12:00:00 -0000"' '[to]=3D"Search By To Name <test@example.com>"'\r
++output=3D$($NOTMUCH search to:'Search By To Name' | notmuch_search_sanitiz=\r
+e)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ search by to (name) (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/01300-search-by-subject-phrase.test =\r
+b/test/tests/notmuch-search/01300-search-by-subject-phrase.test\r
+new file mode 100644\r
+index 0000000..c9e1dc6\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/01300-search-by-subject-phrase.test\r
+@@ -0,0 +1,5 @@\r
++printf " Search by subject: (phrase)...\t\t\t"\r
++add_message '[subject]=3D"subject search test (phrase)"' '[date]=3D"Sat, 0=\r
+1 Jan 2000 12:00:00 -0000"'\r
++add_message '[subject]=3D"this phrase should not match the subject search =\r
+test"' '[date]=3D"Sat, 01 Jan 2000 12:00:00 -0000"'\r
++output=3D$($NOTMUCH search 'subject:\"subject search test (phrase)\"' | no=\r
+tmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ subject search test (phrase) (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/01400-search-for-all-messages.test b=\r
+/test/tests/notmuch-search/01400-search-for-all-messages.test\r
+new file mode 100644\r
+index 0000000..4120442\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/01400-search-for-all-messages.test\r
+@@ -0,0 +1,19 @@\r
++printf " Search for all messages (\"*\"):...\t\t"\r
++output=3D$($NOTMUCH search '*' | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite;=\r
+ Test message #6 (inbox unread)\r
++thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #14 (inbox =\r
+unread)\r
++thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body search (inbox unrea=\r
+d)\r
++thread:XXX   2000-01-01 [1/1] searchbyfrom; search by from (inbox unread)\r
++thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unre=\r
+ad)\r
++thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox=\r
+ unread)\r
++thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unre=\r
+ad)\r
++thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by tag (inbox sea=\r
+rchbytag unread)\r
++thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by thread (inbox =\r
+unread)\r
++thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body search (phrase) (in=\r
+box unread)\r
++thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; negative result (inbox u=\r
+nread)\r
++thread:XXX   2000-01-01 [1/1] searchbyfrom@example.com; search by from (ad=\r
+dress) (inbox unread)\r
++thread:XXX   2000-01-01 [1/1] Search By From Name; search by from (name) (=\r
+inbox unread)\r
++thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (address) (=\r
+inbox unread)\r
++thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inb=\r
+ox unread)\r
++thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; subject search test (phr=\r
+ase) (inbox unread)\r
++thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; this phrase should not m=\r
+atch the subject search test (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/01500-search-body-utf-8.test b/test/=\r
+tests/notmuch-search/01500-search-body-utf-8.test\r
+new file mode 100644\r
+index 0000000..413d29d\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/01500-search-body-utf-8.test\r
+@@ -0,0 +1,4 @@\r
++printf " Search body (utf-8):...\t\t\t"\r
++add_message '[subject]=3D"utf8-message-body-subject"' '[date]=3D"Sat, 01 J=\r
+an 2000 12:00:00 -0000"' '[body]=3D"message body utf8: b=C3=B6d=C3=BD"'\r
++output=3D$($NOTMUCH search 'b=C3=B6d=C3=BD' | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ utf8-message-body-subject (inbox unread)"\r
+diff --git a/test/tests/notmuch-search/99999-notmuch-search.setup b/test/te=\r
+sts/notmuch-search/99999-notmuch-search.setup\r
+new file mode 100644\r
+index 0000000..ce00cfc\r
+--- /dev/null\r
++++ b/test/tests/notmuch-search/99999-notmuch-search.setup\r
+@@ -0,0 +1,4 @@\r
++printf " Cleaning up...\n"\r
++\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++$NOTMUCH new > /dev/null\r
+diff --git a/test/tests/out-of-order-threading/00001-out-of-order-threading=\r
+.setup b/test/tests/out-of-order-threading/00001-out-of-order-threading.set=\r
+up\r
+new file mode 100644\r
+index 0000000..3edc3cb\r
+--- /dev/null\r
++++ b/test/tests/out-of-order-threading/00001-out-of-order-threading.setup\r
+@@ -0,0 +1,2 @@\r
++printf "\nTesting threading when messages received out of order:\n"\r
++printf " Setting up...\n"\r
+diff --git a/test/tests/out-of-order-threading/00100-addinitial-child-messa=\r
+ge.test b/test/tests/out-of-order-threading/00100-addinitial-child-message.=\r
+test\r
+new file mode 100644\r
+index 0000000..c2a6588\r
+--- /dev/null\r
++++ b/test/tests/out-of-order-threading/00100-addinitial-child-message.test\r
+@@ -0,0 +1,4 @@\r
++printf " Adding initial child message...\t\t"\r
++generate_message [body]=3Dfoo '[in-reply-to]=3D\<parent-id\>' [subject]=3D=\r
+brokenthreadtest '[date]=3D"Sat, 01 Jan 2000 12:00:00 -0000"'\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 1 new message to the database."\r
+diff --git a/test/tests/out-of-order-threading/00200-searching-returns-mess=\r
+age.test b/test/tests/out-of-order-threading/00200-searching-returns-messag=\r
+e.test\r
+new file mode 100644\r
+index 0000000..fbda06d\r
+--- /dev/null\r
++++ b/test/tests/out-of-order-threading/00200-searching-returns-message.test\r
+@@ -0,0 +1,3 @@\r
++printf " Searching returns the message...\t\t"\r
++output=3D$($NOTMUCH search foo | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ brokenthreadtest (inbox unread)"\r
+diff --git a/test/tests/out-of-order-threading/00300-adding-second-child-me=\r
+ssage.test b/test/tests/out-of-order-threading/00300-adding-second-child-me=\r
+ssage.test\r
+new file mode 100644\r
+index 0000000..1d3ac41\r
+--- /dev/null\r
++++ b/test/tests/out-of-order-threading/00300-adding-second-child-message.t=\r
+est\r
+@@ -0,0 +1,4 @@\r
++printf " Adding second child message...\t\t\t"\r
++generate_message [body]=3Dfoo '[in-reply-to]=3D\<parent-id\>' [subject]=3D=\r
+brokenthreadtest '[date]=3D"Sat, 01 Jan 2000 12:00:00 -0000"'\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 1 new message to the database."\r
+diff --git a/test/tests/out-of-order-threading/00400-searching-returns-both=\r
+-msgs.test b/test/tests/out-of-order-threading/00400-searching-returns-both=\r
+-msgs.test\r
+new file mode 100644\r
+index 0000000..9b1483e\r
+--- /dev/null\r
++++ b/test/tests/out-of-order-threading/00400-searching-returns-both-msgs.t=\r
+est\r
+@@ -0,0 +1,3 @@\r
++printf " Searching returns both messages in one thread..."\r
++output=3D$($NOTMUCH search foo | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [2/2] Notmuch Test Suite;=\r
+ brokenthreadtest (inbox unread)"\r
+diff --git a/test/tests/out-of-order-threading/00500-adding-parent-msg.test=\r
+ b/test/tests/out-of-order-threading/00500-adding-parent-msg.test\r
+new file mode 100644\r
+index 0000000..c77c0ae\r
+--- /dev/null\r
++++ b/test/tests/out-of-order-threading/00500-adding-parent-msg.test\r
+@@ -0,0 +1,4 @@\r
++printf " Adding parent message...\t\t\t"\r
++generate_message [body]=3Dfoo [id]=3Dparent-id [subject]=3Dbrokenthreadtes=\r
+t '[date]=3D"Sat, 01 Jan 2000 12:00:00 -0000"'\r
++output=3D$(NOTMUCH_NEW)\r
++pass_if_equal "$output" "Added 1 new message to the database."\r
+diff --git a/test/tests/out-of-order-threading/00600-return-all-msgs-in-one=\r
+-thread.test b/test/tests/out-of-order-threading/00600-return-all-msgs-in-o=\r
+ne-thread.test\r
+new file mode 100644\r
+index 0000000..91ea3c2\r
+--- /dev/null\r
++++ b/test/tests/out-of-order-threading/00600-return-all-msgs-in-one-thread=\r
+.test\r
+@@ -0,0 +1,3 @@\r
++printf " Searching returns all three messages in one thread..."\r
++output=3D$($NOTMUCH search foo | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [3/3] Notmuch Test Suite;=\r
+ brokenthreadtest (inbox unread)"\r
+diff --git a/test/tests/out-of-order-threading/99999-out-of-order-threading=\r
+.setup b/test/tests/out-of-order-threading/99999-out-of-order-threading.set=\r
+up\r
+new file mode 100644\r
+index 0000000..ce00cfc\r
+--- /dev/null\r
++++ b/test/tests/out-of-order-threading/99999-out-of-order-threading.setup\r
+@@ -0,0 +1,4 @@\r
++printf " Cleaning up...\n"\r
++\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++$NOTMUCH new > /dev/null\r
+diff --git a/test/tests/thread-naming/00001-thread-naming.setup b/test/test=\r
+s/thread-naming/00001-thread-naming.setup\r
+new file mode 100644\r
+index 0000000..cc0d764\r
+--- /dev/null\r
++++ b/test/tests/thread-naming/00001-thread-naming.setup\r
+@@ -0,0 +1,17 @@\r
++printf "\nTesting naming of threads with changing subject:\n"\r
++printf " Setting up...\n"\r
++\r
++add_message '[subject]=3D"thread-naming: Initial thread subject"' \\r
++            '[date]=3D"Fri, 05 Jan 2001 15:43:56 -0800"'\r
++first=3D${gen_msg_cnt}\r
++parent=3D${gen_msg_id}\r
++add_message '[subject]=3D"thread-naming: Older changed subject"' \\r
++            '[date]=3D"Sat, 06 Jan 2001 15:43:56 -0800"' \\r
++            "[in-reply-to]=3D\<$parent\>"\r
++add_message '[subject]=3D"thread-naming: Newer changed subject"' \\r
++            '[date]=3D"Sun, 07 Jan 2001 15:43:56 -0800"' \\r
++            "[in-reply-to]=3D\<$parent\>"\r
++add_message '[subject]=3D"thread-naming: Final thread subject"' \\r
++            '[date]=3D"Mon, 08 Jan 2001 15:43:56 -0800"' \\r
++            "[in-reply-to]=3D\<$parent\>"\r
++final=3D${gen_msg_id}\r
+diff --git a/test/tests/thread-naming/00100-initial-thread-name-oldest-firs=\r
+t-search.test b/test/tests/thread-naming/00100-initial-thread-name-oldest-f=\r
+irst-search.test\r
+new file mode 100644\r
+index 0000000..482a7f4\r
+--- /dev/null\r
++++ b/test/tests/thread-naming/00100-initial-thread-name-oldest-first-searc=\r
+h.test\r
+@@ -0,0 +1,3 @@\r
++printf " Initial thread name (oldest-first search)...\t"\r
++output=3D$($NOTMUCH search --sort=3Doldest-first thread-naming and tag:inb=\r
+ox | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2001-01-05 [4/4] Notmuch Test Suite;=\r
+ thread-naming: Initial thread subject (inbox unread)"\r
+diff --git a/test/tests/thread-naming/00200-initial-thread-name-newest-firs=\r
+t-search.test b/test/tests/thread-naming/00200-initial-thread-name-newest-f=\r
+irst-search.test\r
+new file mode 100644\r
+index 0000000..799ed66\r
+--- /dev/null\r
++++ b/test/tests/thread-naming/00200-initial-thread-name-newest-first-searc=\r
+h.test\r
+@@ -0,0 +1,3 @@\r
++printf " Initial thread name (newest-first search)...\t"\r
++output=3D$($NOTMUCH search --sort=3Dnewest-first thread-naming and tag:inb=\r
+ox | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2001-01-08 [4/4] Notmuch Test Suite;=\r
+ thread-naming: Final thread subject (inbox unread)"\r
+diff --git a/test/tests/thread-naming/00300-changed-thread-name-oldest-firs=\r
+t-search.test b/test/tests/thread-naming/00300-changed-thread-name-oldest-f=\r
+irst-search.test\r
+new file mode 100644\r
+index 0000000..5d300d6\r
+--- /dev/null\r
++++ b/test/tests/thread-naming/00300-changed-thread-name-oldest-first-searc=\r
+h.test\r
+@@ -0,0 +1,6 @@\r
++# Remove oldest and newest messages from search results\r
++$NOTMUCH tag -inbox id:$parent or id:$final\r
++\r
++printf " Changed thread name (oldest-first search)...\t"\r
++output=3D$($NOTMUCH search --sort=3Doldest-first thread-naming and tag:inb=\r
+ox | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2001-01-06 [2/4] Notmuch Test Suite;=\r
+ thread-naming: Older changed subject (inbox unread)"\r
+diff --git a/test/tests/thread-naming/00400-changed-thread-name-newest-firs=\r
+t-search.test b/test/tests/thread-naming/00400-changed-thread-name-newest-f=\r
+irst-search.test\r
+new file mode 100644\r
+index 0000000..f412770\r
+--- /dev/null\r
++++ b/test/tests/thread-naming/00400-changed-thread-name-newest-first-searc=\r
+h.test\r
+@@ -0,0 +1,3 @@\r
++printf " Changed thread name (newest-first search)...\t"\r
++output=3D$($NOTMUCH search --sort=3Dnewest-first thread-naming and tag:inb=\r
+ox | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2001-01-07 [2/4] Notmuch Test Suite;=\r
+ thread-naming: Newer changed subject (inbox unread)"\r
+diff --git a/test/tests/thread-naming/00500-ignore-added-reply-prefix-re.te=\r
+st b/test/tests/thread-naming/00500-ignore-added-reply-prefix-re.test\r
+new file mode 100644\r
+index 0000000..7c1544a\r
+--- /dev/null\r
++++ b/test/tests/thread-naming/00500-ignore-added-reply-prefix-re.test\r
+@@ -0,0 +1,6 @@\r
++printf " Ignore added reply prefix (Re:)...\t\t"\r
++add_message '[subject]=3D"Re: thread-naming: Initial thread subject"' \\r
++            '[date]=3D"Tue, 09 Jan 2001 15:43:45 -0800"' \\r
++            "[in-reply-to]=3D\<$parent\>"\r
++output=3D$($NOTMUCH search --sort=3Dnewest-first thread-naming and tag:inb=\r
+ox | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2001-01-09 [3/5] Notmuch Test Suite;=\r
+ thread-naming: Initial thread subject (inbox unread)"\r
+diff --git a/test/tests/thread-naming/00600-ignore-added-reply-prefix-aw.te=\r
+st b/test/tests/thread-naming/00600-ignore-added-reply-prefix-aw.test\r
+new file mode 100644\r
+index 0000000..d279fd1\r
+--- /dev/null\r
++++ b/test/tests/thread-naming/00600-ignore-added-reply-prefix-aw.test\r
+@@ -0,0 +1,6 @@\r
++printf " Ignore added reply prefix (Aw:)...\t\t"\r
++add_message '[subject]=3D"Aw: thread-naming: Initial thread subject"' \\r
++            '[date]=3D"Wed, 10 Jan 2001 15:43:45 -0800"' \\r
++            "[in-reply-to]=3D\<$parent\>"\r
++output=3D$($NOTMUCH search --sort=3Dnewest-first thread-naming and tag:inb=\r
+ox | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2001-01-10 [4/6] Notmuch Test Suite;=\r
+ thread-naming: Initial thread subject (inbox unread)"\r
+diff --git a/test/tests/thread-naming/00700-ignore-added-reply-prefix-vs.te=\r
+st b/test/tests/thread-naming/00700-ignore-added-reply-prefix-vs.test\r
+new file mode 100644\r
+index 0000000..02b6b0e\r
+--- /dev/null\r
++++ b/test/tests/thread-naming/00700-ignore-added-reply-prefix-vs.test\r
+@@ -0,0 +1,6 @@\r
++printf " Ignore added reply prefix (Vs:)...\t\t"\r
++add_message '[subject]=3D"Vs: thread-naming: Initial thread subject"' \\r
++            '[date]=3D"Thu, 11 Jan 2001 15:43:45 -0800"' \\r
++            "[in-reply-to]=3D\<$parent\>"\r
++output=3D$($NOTMUCH search --sort=3Dnewest-first thread-naming and tag:inb=\r
+ox | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2001-01-11 [5/7] Notmuch Test Suite;=\r
+ thread-naming: Initial thread subject (inbox unread)"\r
+diff --git a/test/tests/thread-naming/00800-ignore-added-reply-prefix-sv.te=\r
+st b/test/tests/thread-naming/00800-ignore-added-reply-prefix-sv.test\r
+new file mode 100644\r
+index 0000000..1014ece\r
+--- /dev/null\r
++++ b/test/tests/thread-naming/00800-ignore-added-reply-prefix-sv.test\r
+@@ -0,0 +1,6 @@\r
++printf " Ignore added reply prefix (Sv:)...\t\t"\r
++add_message '[subject]=3D"Sv: thread-naming: Initial thread subject"' \\r
++            '[date]=3D"Fri, 12 Jan 2001 15:43:45 -0800"' \\r
++            "[in-reply-to]=3D\<$parent\>"\r
++output=3D$($NOTMUCH search --sort=3Dnewest-first thread-naming and tag:inb=\r
+ox | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2001-01-12 [6/8] Notmuch Test Suite;=\r
+ thread-naming: Initial thread subject (inbox unread)"\r
+diff --git a/test/tests/thread-naming/00900-test-order-of-messages-in-nm-sh=\r
+ow.test b/test/tests/thread-naming/00900-test-order-of-messages-in-nm-show.=\r
+test\r
+new file mode 100644\r
+index 0000000..61af4c1\r
+--- /dev/null\r
++++ b/test/tests/thread-naming/00900-test-order-of-messages-in-nm-show.test\r
+@@ -0,0 +1,114 @@\r
++printf " Test order of messages in \"notmuch show\"\t"\r
++output=3D$($NOTMUCH show thread-naming | notmuch_show_sanitize)\r
++pass_if_equal "$output" "\f\r
+message{ id:msg-$(printf "%03d" $first)@notmuch-=\r
+test-suite depth:0 match:1 filename:/XXX/mail/msg-$(printf "%03d" $first)\r
++\f\r
+header{\r
++Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (unread)\r
++Subject: thread-naming: Initial thread subject\r
++From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++Date: Fri, 05 Jan 2001 15:43:56 -0800\r
++\f\r
+header}\r
++\f\r
+body{\r
++\f\r
+part{ ID: 1, Content-type: text/plain\r
++This is just a test message (#$first)\r
++\f\r
+part}\r
++\f\r
+body}\r
++\f\r
+message}\r
++\f\r
+message{ id:msg-$(printf "%03d" $((first + 1)))@notmuch-test-suite depth:=\r
+1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 1)))\r
++\f\r
+header{\r
++Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-06) (inbox unread)\r
++Subject: thread-naming: Older changed subject\r
++From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++Date: Sat, 06 Jan 2001 15:43:56 -0800\r
++\f\r
+header}\r
++\f\r
+body{\r
++\f\r
+part{ ID: 1, Content-type: text/plain\r
++This is just a test message (#$((first + 1)))\r
++\f\r
+part}\r
++\f\r
+body}\r
++\f\r
+message}\r
++\f\r
+message{ id:msg-$(printf "%03d" $((first + 2)))@notmuch-test-suite depth:=\r
+1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 2)))\r
++\f\r
+header{\r
++Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-07) (inbox unread)\r
++Subject: thread-naming: Newer changed subject\r
++From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++Date: Sun, 07 Jan 2001 15:43:56 -0800\r
++\f\r
+header}\r
++\f\r
+body{\r
++\f\r
+part{ ID: 1, Content-type: text/plain\r
++This is just a test message (#$((first + 2)))\r
++\f\r
+part}\r
++\f\r
+body}\r
++\f\r
+message}\r
++\f\r
+message{ id:msg-$(printf "%03d" $((first + 3)))@notmuch-test-suite depth:=\r
+1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 3)))\r
++\f\r
+header{\r
++Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-08) (unread)\r
++Subject: thread-naming: Final thread subject\r
++From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++Date: Mon, 08 Jan 2001 15:43:56 -0800\r
++\f\r
+header}\r
++\f\r
+body{\r
++\f\r
+part{ ID: 1, Content-type: text/plain\r
++This is just a test message (#$((first + 3)))\r
++\f\r
+part}\r
++\f\r
+body}\r
++\f\r
+message}\r
++\f\r
+message{ id:msg-$(printf "%03d" $((first + 4)))@notmuch-test-suite depth:=\r
+1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 4)))\r
++\f\r
+header{\r
++Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-09) (inbox unread)\r
++Subject: Re: thread-naming: Initial thread subject\r
++From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++Date: Tue, 09 Jan 2001 15:43:45 -0800\r
++\f\r
+header}\r
++\f\r
+body{\r
++\f\r
+part{ ID: 1, Content-type: text/plain\r
++This is just a test message (#$((first + 4)))\r
++\f\r
+part}\r
++\f\r
+body}\r
++\f\r
+message}\r
++\f\r
+message{ id:msg-$(printf "%03d" $((first + 5)))@notmuch-test-suite depth:=\r
+1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 5)))\r
++\f\r
+header{\r
++Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-10) (inbox unread)\r
++Subject: Aw: thread-naming: Initial thread subject\r
++From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++Date: Wed, 10 Jan 2001 15:43:45 -0800\r
++\f\r
+header}\r
++\f\r
+body{\r
++\f\r
+part{ ID: 1, Content-type: text/plain\r
++This is just a test message (#$((first + 5)))\r
++\f\r
+part}\r
++\f\r
+body}\r
++\f\r
+message}\r
++\f\r
+message{ id:msg-$(printf "%03d" $((first + 6)))@notmuch-test-suite depth:=\r
+1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 6)))\r
++\f\r
+header{\r
++Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-11) (inbox unread)\r
++Subject: Vs: thread-naming: Initial thread subject\r
++From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++Date: Thu, 11 Jan 2001 15:43:45 -0800\r
++\f\r
+header}\r
++\f\r
+body{\r
++\f\r
+part{ ID: 1, Content-type: text/plain\r
++This is just a test message (#$((first + 6)))\r
++\f\r
+part}\r
++\f\r
+body}\r
++\f\r
+message}\r
++\f\r
+message{ id:msg-$(printf "%03d" $((first + 7)))@notmuch-test-suite depth:=\r
+1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 7)))\r
++\f\r
+header{\r
++Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-12) (inbox unread)\r
++Subject: Sv: thread-naming: Initial thread subject\r
++From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
++Date: Fri, 12 Jan 2001 15:43:45 -0800\r
++\f\r
+header}\r
++\f\r
+body{\r
++\f\r
+part{ ID: 1, Content-type: text/plain\r
++This is just a test message (#$((first + 7)))\r
++\f\r
+part}\r
++\f\r
+body}\r
++\f\r
+message}"\r
+diff --git a/test/tests/thread-naming/99999-thread-naming.setup b/test/test=\r
+s/thread-naming/99999-thread-naming.setup\r
+new file mode 100644\r
+index 0000000..ce00cfc\r
+--- /dev/null\r
++++ b/test/tests/thread-naming/99999-thread-naming.setup\r
+@@ -0,0 +1,4 @@\r
++printf " Cleaning up...\n"\r
++\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++$NOTMUCH new > /dev/null\r
+diff --git a/test/tests/uuencoded/00001-uuencoded.setup b/test/tests/uuenco=\r
+ded/00001-uuencoded.setup\r
+new file mode 100644\r
+index 0000000..11e6694\r
+--- /dev/null\r
++++ b/test/tests/uuencoded/00001-uuencoded.setup\r
+@@ -0,0 +1,19 @@\r
++printf "\nTesting handling of uuencoded data:\n"\r
++printf " Setting up...\n"\r
++\r
++add_message [subject]=3Duuencodetest '[date]=3D"Sat, 01 Jan 2000 12:00:00 =\r
+-0000"' \\r
++'[body]=3D"This message is used to ensure that notmuch correctly handles a\r
++message containing a block of uuencoded data. First, we have a marker\r
++this content beforeuudata . Then we beging the uunencoded data itself:\r
++\r
++begin 644 bogus-uuencoded-data\r
++M0123456789012345678901234567890123456789012345678901234567890\r
++MOBVIOUSLY, THIS IS NOT ANY SORT OF USEFUL UUNECODED DATA.\r
++MINSTEAD THIS IS JUST A WAY TO ENSURE THAT THIS BLOCK OF DATA\r
++MIS CORRECTLY IGNORED WHEN NOTMUCH CREATES ITS INDEX. SO WE\r
++MINCLUDE A DURINGUUDATA MARKER THAT SHOULD NOT RESULT IN ANY\r
++MSEARCH RESULT.\r
++\`\r
++end\r
++\r
++Finally, we have our afteruudata marker as well."'\r
+diff --git a/test/tests/uuencoded/00100-index-content-before-uu.test b/test=\r
+/tests/uuencoded/00100-index-content-before-uu.test\r
+new file mode 100644\r
+index 0000000..97d04a8\r
+--- /dev/null\r
++++ b/test/tests/uuencoded/00100-index-content-before-uu.test\r
+@@ -0,0 +1,3 @@\r
++printf " Ensure content before uu data is indexed...\t"\r
++output=3D$($NOTMUCH search beforeuudata | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ uuencodetest (inbox unread)"\r
+diff --git a/test/tests/uuencoded/00200-dont-index-uu-data.test b/test/test=\r
+s/uuencoded/00200-dont-index-uu-data.test\r
+new file mode 100644\r
+index 0000000..dcfe41e\r
+--- /dev/null\r
++++ b/test/tests/uuencoded/00200-dont-index-uu-data.test\r
+@@ -0,0 +1,3 @@\r
++printf " Ensure uu data is not indexed...\t\t"\r
++output=3D$($NOTMUCH search DURINGUUDATA | notmuch_search_sanitize)\r
++pass_if_equal "$output" ""\r
+diff --git a/test/tests/uuencoded/00300-index-data-after-uu.test b/test/tes=\r
+ts/uuencoded/00300-index-data-after-uu.test\r
+new file mode 100644\r
+index 0000000..1cd7221\r
+--- /dev/null\r
++++ b/test/tests/uuencoded/00300-index-data-after-uu.test\r
+@@ -0,0 +1,3 @@\r
++printf " Ensure content after uu data is indexed...\t"\r
++output=3D$($NOTMUCH search afteruudata | notmuch_search_sanitize)\r
++pass_if_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite;=\r
+ uuencodetest (inbox unread)"\r
+diff --git a/test/tests/uuencoded/99999-uuencoded.setup b/test/tests/uuenco=\r
+ded/99999-uuencoded.setup\r
+new file mode 100644\r
+index 0000000..ce00cfc\r
+--- /dev/null\r
++++ b/test/tests/uuencoded/99999-uuencoded.setup\r
+@@ -0,0 +1,4 @@\r
++printf " Cleaning up...\n"\r
++\r
++rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
++$NOTMUCH new > /dev/null\r
+--=20\r
+1.6.3.3\r
+\r