unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob f4d5ee1479bae98b8d52f29682aefa66cc50b271 1273 bytes (raw)
name: test/T110-search-position-overlap-bug.sh 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
#!/usr/bin/env bash

# Test to demonstrate a position overlap bug.
#
# At one point, notmuch would index terms incorrectly in the case of
# calling index_terms multiple times for a single field. The term
# generator was being reset to position 0 each time. This means that
# with text such as:
#
#	To: a@b.c, x@y.z
#
# one could get a bogus match by searching for:
#
#	To: a@y.c
#
# Thanks to Mark Anderson for reporting the bug, (and providing a nice,
# minimal test case that inspired what is used here), in
# id:3wd4o8wa7fx.fsf@testarossa.amd.com

test_description='that notmuch does not overlap term positions'
. $(dirname "$0")/test-lib.sh || exit 1

add_message '[to]="a@b.c, x@y.z"'

test_begin_subtest "Search for a@b.c matches"
output=$(notmuch search a@b.c | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #1 (inbox unread)"

test_begin_subtest "Search for x@y.z matches"
output=$(notmuch search x@y.z | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Test message #1 (inbox unread)"

test_begin_subtest "Search for a@y.c must not match"
output=$(notmuch search a@y.c | notmuch_search_sanitize)
test_expect_equal "$output" ""

test_done

debug log:

solving f4d5ee1479ba ...
found f4d5ee1479ba in https://yhetil.org/notmuch.git/

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).