[PATCH] test: Known-broken test for overlapping/adjacent termpos

Austin Clements amdragon at MIT.EDU
Sat May 17 13:45:52 PDT 2014


This adds two known-broken tests and one working test related to the
term positions assigned to terms from different headers or MIME parts.
The first test fails because we don't create a termpos gap between
different headers.  The second test fails because we don't adjust
termpos at all when indexing multiple parts.
---

Thanks to ohm` on IRC for pointing out that we were doing some
surprising things with term positions in _notmuch_message_gen_terms.

These should be easy to fix for future messages and, given that nobody
seems to have noticed, it's probably not a big deal for already
indexed messages.

 test/T080-search.sh | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/test/T080-search.sh b/test/T080-search.sh
index a7a0b18..df972e1 100755
--- a/test/T080-search.sh
+++ b/test/T080-search.sh
@@ -129,4 +129,44 @@ add_message '[subject]="utf8-message-body-subject"' '[date]="Sat, 01 Jan 2000 12
 output=$(notmuch search "bödý" | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; utf8-message-body-subject (inbox unread)"
 
+
+cat <<EOF > ${MAIL_DIR}/termpos
+From: Source <source at example.com>
+To: Dest <dest at example.com>
+Subject: part overlap test
+Date: Sat, 01 January 2000 00:00:00 +0000
+Message-ID: <termpos>
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="==-=="
+
+--==-==
+Content-Type: text/plain
+
+a b c
+
+--==-==
+Content-Type: text/plain
+
+x y z
+
+--==-==--
+EOF
+notmuch new > /dev/null
+
+test_begin_subtest "headers do not have adjacent term positions"
+test_subtest_known_broken
+# Test for bug where "To" is indexed immediately after "From" without
+# a termpos gap
+output=$(notmuch search id:termpos and "com dest")
+test_expect_equal "$output" ""
+
+test_begin_subtest "parts have non-overlapping term positions"
+test_subtest_known_broken
+output=$(notmuch search id:termpos and '"a y c"')
+test_expect_equal "$output" ""
+
+test_begin_subtest "parts do not have adjacent term positions"
+output=$(notmuch search id:termpos and '"c x"')
+test_expect_equal "$output" ""
+
 test_done
-- 
1.9.1



More information about the notmuch mailing list