X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2FT080-search.sh;h=a3f0dead1420239fd654c89ea04531d1ee141729;hp=a7a0b18d2e48d21f09890aca61cc63f3eb8bd2f6;hb=0a2929c341b6d5f20210725facf37a6e2c3a19b4;hpb=28d7544ae2adfe6467c6b64a3284f5ed13f81e1a diff --git a/test/T080-search.sh b/test/T080-search.sh index a7a0b18d..a3f0dead 100755 --- a/test/T080-search.sh +++ b/test/T080-search.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash test_description='"notmuch search" in several variations' -. ./test-lib.sh +. $(dirname "$0")/test-lib.sh || exit 1 add_email_corpus @@ -34,6 +34,11 @@ add_message '[subject]="search by id"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000" output=$(notmuch search id:${gen_msg_id} | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)" +test_begin_subtest "Search by mid:" +add_message '[subject]="search by mid"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' +output=$(notmuch search mid:${gen_msg_id} | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by mid (inbox unread)" + test_begin_subtest "Search by tag:" add_message '[subject]="search by tag"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' notmuch tag +searchbytag id:${gen_msg_id} @@ -59,7 +64,15 @@ test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] searchbyfrom@example. test_begin_subtest "Search by from: (name)" add_message '[subject]="search by from (name)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[from]="Search By From Name "' -output=$(notmuch search from:"Search By From Name" | notmuch_search_sanitize) +output=$(notmuch search 'from:"Search By From Name"' | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Search By From Name; search by from (name) (inbox unread)" + +test_begin_subtest "Search by from: (name and address)" +output=$(notmuch search 'from:"Search By From Name "' | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Search By From Name; search by from (name) (inbox unread)" + +test_begin_subtest "Search by from: without prefix (name and address)" +output=$(notmuch search '"Search By From Name "' | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Search By From Name; search by from (name) (inbox unread)" test_begin_subtest "Search by to: (address)" @@ -69,7 +82,15 @@ test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; s test_begin_subtest "Search by to: (name)" add_message '[subject]="search by to (name)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[to]="Search By To Name "' -output=$(notmuch search to:"Search By To Name" | notmuch_search_sanitize) +output=$(notmuch search 'to:"Search By To Name"' | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)" + +test_begin_subtest "Search by to: (name and address)" +output=$(notmuch search 'to:"Search By To Name "' | notmuch_search_sanitize) +test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)" + +test_begin_subtest "Search by to: without prefix (name and address)" +output=$(notmuch search '"Search By To Name "' | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)" test_begin_subtest "Search by subject: (phrase)" @@ -90,7 +111,7 @@ thread:XXX 2009-11-18 [3/3] Adrian Perez de Castro, Keith Packard, Carl Worth; thread:XXX 2009-11-18 [3/3] Israel Herraiz, Keith Packard, Carl Worth; [notmuch] New to the list (inbox unread) thread:XXX 2009-11-18 [3/3] Jan Janak, Carl Worth; [notmuch] What a great idea! (inbox unread) thread:XXX 2009-11-18 [2/2] Jan Janak, Carl Worth; [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread) -thread:XXX 2009-11-18 [3/3] Aron Griffis, Keith Packard, Carl Worth; [notmuch] archive (inbox unread) +thread:XXX 2009-11-18 [3/3(4)] Aron Griffis, Keith Packard, Carl Worth; [notmuch] archive (inbox unread) thread:XXX 2009-11-18 [2/2] Keith Packard, Carl Worth; [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread) thread:XXX 2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread) thread:XXX 2009-11-18 [5/5] Mikhail Gusarov, Carl Worth, Keith Packard; [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread) @@ -111,6 +132,7 @@ thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unread) thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox unread) thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; utf8-sübjéct (inbox unread) thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread) +thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by mid (inbox unread) thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by tag (inbox searchbytag unread) thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by thread (inbox unread) thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; body search (phrase) (inbox unread) @@ -122,11 +144,49 @@ thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unr thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; subject search test (phrase) (inbox unread) thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; this phrase should not match the subject search test (inbox unread) EOF -test_expect_equal_file OUTPUT EXPECTED +test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "Search body (utf-8):" add_message '[subject]="utf8-message-body-subject"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="message body utf8: bödý"' 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 < ${MAIL_DIR}/termpos +From: Source +To: Dest +Subject: part overlap test +Date: Sat, 01 January 2000 00:00:00 +0000 +Message-ID: +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" +# Regression test for a bug where term positions for non-prefixed +# terms weren't updated +output=$(notmuch search id:termpos and '"com dest"') +test_expect_equal "$output" "" + +test_begin_subtest "parts have non-overlapping term positions" +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