--- /dev/null
+Return-Path: <amdragon@mit.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 08585431FBF\r
+ for <notmuch@notmuchmail.org>; Sat, 17 May 2014 13:46:13 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id dkUZwSfrVFei for <notmuch@notmuchmail.org>;\r
+ Sat, 17 May 2014 13:46:06 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-5.mit.edu (dmz-mailsec-scanner-5.mit.edu\r
+ [18.7.68.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 61A7D431FBC\r
+ for <notmuch@notmuchmail.org>; Sat, 17 May 2014 13:46:06 -0700 (PDT)\r
+X-AuditID: 12074422-f79376d000000c58-88-5377ca8cb1dd\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+ (using TLS with cipher AES256-SHA (256/256 bits))\r
+ (Client did not present a certificate)\r
+ by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id E9.9D.03160.C8AC7735; Sat, 17 May 2014 16:46:04 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s4HKjww4017387; \r
+ Sat, 17 May 2014 16:45:59 -0400\r
+Received: from drake.dyndns.org\r
+ (static-155-212-141-65.mas.onecommunications.net [155.212.141.65])\r
+ (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s4HKjtbR014539\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Sat, 17 May 2014 16:45:58 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1WllUR-0002ue-Nd; Sat, 17 May 2014 16:45:55 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] test: Known-broken test for overlapping/adjacent termpos\r
+Date: Sat, 17 May 2014 16:45:52 -0400\r
+Message-Id: <1400359552-10928-1-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.9.1\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFnrNIsWRmVeSWpSXmKPExsUixG6nottzqjzY4McMMYvrN2cyOzB6PFt1\r
+ izmAMYrLJiU1J7MstUjfLoErY2LLLZaC5YIV86a0sTcwHuDrYuTkkBAwkXh0ZgorhC0mceHe\r
+ erYuRi4OIYHZTBL7rmxjhnA2Mko8fL6ODaRKSOAGk0TfyhiIxFxGiQ8f+8Ha2QQ0JLbtX84I\r
+ YosISEvsvDsbKM7BwSygJvGnSwUkLCzgKXGlt58NJMwioCrx/IMBSJhXwEHixKZDzBBHyEmc\r
+ PDaZFSIuKHFy5hMWiCnqEuvnCYGEmQXkJZq3zmaewCgwC0nVLISqWUiqFjAyr2KUTcmt0s1N\r
+ zMwpTk3WLU5OzMtLLdI11cvNLNFLTSndxAgORxelHYw/DyodYhTgYFTi4eWwLQsWYk0sK67M\r
+ PcQoycGkJMrrt6s8WIgvKT+lMiOxOCO+qDQntfgQowQHs5IIb+ZsoBxvSmJlVWpRPkxKmoNF\r
+ SZz3rbVVsJBAemJJanZqakFqEUxWhoNDSYL3wUmgRsGi1PTUirTMnBKENBMHJ8hwHqDhYDW8\r
+ xQWJucWZ6RD5U4y6HKv+nWljEmLJy89LlRLn3XACqEgApCijNA9uDiyNvGIUB3pLmPclyCge\r
+ YAqCm/QKaAkT0JI3e0tBlpQkIqSkGhjb509x7WrT42VUuyz6jC36WOlxqxmZB6XdjNu/pJbx\r
+ LYyaltZzMrFd5vxinUtr7md79l/cIs+eZ2Rr27HAqWPBUu/lztlLz320aPzoUHx/nt8unlrn\r
+ O+tSkw+p3NqgUf1HcLGJsvFKNvfIoEkzHoTL/xO04p7jEyzGsWviB/+7pXePKa3YEqLEUpyR\r
+ aKjFXFScCADw/Spk/gIAAA==\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: Sat, 17 May 2014 20:46:13 -0000\r
+\r
+This adds two known-broken tests and one working test related to the\r
+term positions assigned to terms from different headers or MIME parts.\r
+The first test fails because we don't create a termpos gap between\r
+different headers. The second test fails because we don't adjust\r
+termpos at all when indexing multiple parts.\r
+---\r
+\r
+Thanks to ohm` on IRC for pointing out that we were doing some\r
+surprising things with term positions in _notmuch_message_gen_terms.\r
+\r
+These should be easy to fix for future messages and, given that nobody\r
+seems to have noticed, it's probably not a big deal for already\r
+indexed messages.\r
+\r
+ test/T080-search.sh | 40 ++++++++++++++++++++++++++++++++++++++++\r
+ 1 file changed, 40 insertions(+)\r
+\r
+diff --git a/test/T080-search.sh b/test/T080-search.sh\r
+index a7a0b18..df972e1 100755\r
+--- a/test/T080-search.sh\r
++++ b/test/T080-search.sh\r
+@@ -129,4 +129,44 @@ add_message '[subject]="utf8-message-body-subject"' '[date]="Sat, 01 Jan 2000 12\r
+ output=$(notmuch search "bödý" | notmuch_search_sanitize)\r
+ test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; utf8-message-body-subject (inbox unread)"\r
+ \r
++\r
++cat <<EOF > ${MAIL_DIR}/termpos\r
++From: Source <source@example.com>\r
++To: Dest <dest@example.com>\r
++Subject: part overlap test\r
++Date: Sat, 01 January 2000 00:00:00 +0000\r
++Message-ID: <termpos>\r
++MIME-Version: 1.0\r
++Content-Type: multipart/mixed; boundary="==-=="\r
++\r
++--==-==\r
++Content-Type: text/plain\r
++\r
++a b c\r
++\r
++--==-==\r
++Content-Type: text/plain\r
++\r
++x y z\r
++\r
++--==-==--\r
++EOF\r
++notmuch new > /dev/null\r
++\r
++test_begin_subtest "headers do not have adjacent term positions"\r
++test_subtest_known_broken\r
++# Test for bug where "To" is indexed immediately after "From" without\r
++# a termpos gap\r
++output=$(notmuch search id:termpos and "com dest")\r
++test_expect_equal "$output" ""\r
++\r
++test_begin_subtest "parts have non-overlapping term positions"\r
++test_subtest_known_broken\r
++output=$(notmuch search id:termpos and '"a y c"')\r
++test_expect_equal "$output" ""\r
++\r
++test_begin_subtest "parts do not have adjacent term positions"\r
++output=$(notmuch search id:termpos and '"c x"')\r
++test_expect_equal "$output" ""\r
++\r
+ test_done\r
+-- \r
+1.9.1\r
+\r