1#!/usr/bin/env bash 2test_description='search body' 3. $(dirname "$0")/test-lib.sh || exit 1 4 5add_message "[body]=thebody-1" "[subject]=subject-1" 6add_message "[body]=nothing-to-see-here-1" "[subject]=thebody-1" 7 8test_begin_subtest 'search with body: prefix' 9notmuch search body:thebody | notmuch_search_sanitize > OUTPUT 10cat <<EOF > EXPECTED 11thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; subject-1 (inbox unread) 12EOF 13test_expect_equal_file EXPECTED OUTPUT 14 15test_begin_subtest 'search without body: prefix' 16notmuch search thebody | notmuch_search_sanitize > OUTPUT 17cat <<EOF > EXPECTED 18thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; subject-1 (inbox unread) 19thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; thebody-1 (inbox unread) 20EOF 21test_expect_equal_file EXPECTED OUTPUT 22 23test_begin_subtest 'negated body: prefix' 24notmuch search thebody and not body:thebody | notmuch_search_sanitize > OUTPUT 25cat <<EOF > EXPECTED 26thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; thebody-1 (inbox unread) 27EOF 28test_expect_equal_file EXPECTED OUTPUT 29 30test_begin_subtest 'search unprefixed for prefixed term' 31notmuch search subject | notmuch_search_sanitize > OUTPUT 32cat <<EOF > EXPECTED 33thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; subject-1 (inbox unread) 34EOF 35test_expect_equal_file EXPECTED OUTPUT 36 37test_begin_subtest 'search with body: prefix for term only in subject' 38notmuch search body:subject | notmuch_search_sanitize > OUTPUT 39cat <<EOF > EXPECTED 40EOF 41test_expect_equal_file EXPECTED OUTPUT 42 43test_done 44