notmuch.git  about / heads / tags
Unnamed repository; edit this file 'description' to name the repository.
blob 548b30a4671d2b3c041105b68602ac56c01016d2 1507 bytes (raw)
name: test/T740-body.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
38
39
40
41
42
43
 
#!/usr/bin/env bash
test_description='search body'
. $(dirname "$0")/test-lib.sh || exit 1

add_message "[body]=thebody-1" "[subject]=subject-1"
add_message "[body]=nothing-to-see-here-1" "[subject]=thebody-1"

test_begin_subtest 'search with body: prefix'
notmuch search body:thebody | notmuch_search_sanitize > OUTPUT
cat <<EOF > EXPECTED
thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; subject-1 (inbox unread)
EOF
test_expect_equal_file EXPECTED OUTPUT

test_begin_subtest 'search without body: prefix'
notmuch search thebody | notmuch_search_sanitize > OUTPUT
cat <<EOF > EXPECTED
thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; subject-1 (inbox unread)
thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; thebody-1 (inbox unread)
EOF
test_expect_equal_file EXPECTED OUTPUT

test_begin_subtest 'negated body: prefix'
notmuch search thebody and not body:thebody | notmuch_search_sanitize > OUTPUT
cat <<EOF > EXPECTED
thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; thebody-1 (inbox unread)
EOF
test_expect_equal_file EXPECTED OUTPUT

test_begin_subtest 'search unprefixed for prefixed term'
notmuch search subject | notmuch_search_sanitize > OUTPUT
cat <<EOF > EXPECTED
thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; subject-1 (inbox unread)
EOF
test_expect_equal_file EXPECTED OUTPUT

test_begin_subtest 'search with body: prefix for term only in subject'
notmuch search body:subject | notmuch_search_sanitize > OUTPUT
cat <<EOF > EXPECTED
EOF
test_expect_equal_file EXPECTED OUTPUT

test_done

(*) 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.^

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