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