3 # Test to demonstrate a position overlap bug.
5 # At one point, notmuch would index terms incorrectly in the case of
6 # calling index_terms multiple times for a single field. The term
7 # generator was being reset to position 0 each time. This means that
12 # one could get a bogus match by searching for:
16 # Thanks to Mark Anderson for reporting the bug, (and providing a nice,
17 # minimal test case that inspired what is used here), in
18 # id:3wd4o8wa7fx.fsf@testarossa.amd.com
20 test_description='that notmuch does not overlap term positions'
23 add_message '[to]="a@b.c, x@y.z"'
25 test_begin_subtest "Search for a@b.c matches"
26 output=$(notmuch search a@b.c | notmuch_search_sanitize)
27 test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Test message #1 (inbox unread)"
29 test_begin_subtest "Search for x@y.z matches"
30 output=$(notmuch search x@y.z | notmuch_search_sanitize)
31 test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Test message #1 (inbox unread)"
33 test_begin_subtest "Search for a@y.c must not match"
34 output=$(notmuch search a@y.c | notmuch_search_sanitize)
35 test_expect_equal "$output" ""