2 test_description='messages with missing headers'
3 . $(dirname "$0")/test-lib.sh || exit 1
5 # Notmuch requires at least one of from, subject, or to or it will
6 # ignore the file. Generate two messages so that together they cover
7 # all possible missing headers. We also give one of the messages a
8 # date to ensure stable result ordering.
10 cat <<EOF > "${MAIL_DIR}/msg-2"
11 To: Notmuch Test Suite <test_suite@notmuchmail.org>
12 Date: Fri, 05 Jan 2001 15:43:57 +0000
17 cat <<EOF > "${MAIL_DIR}/msg-1"
18 From: Notmuch Test Suite <test_suite@notmuchmail.org>
23 NOTMUCH_NEW >/dev/null
25 test_begin_subtest "Search: text"
26 output=$(notmuch search '*' | notmuch_search_sanitize)
27 test_expect_equal "$output" "\
28 thread:XXX 2001-01-05 [1/1] ; (inbox unread)
29 thread:XXX 1970-01-01 [1/1] Notmuch Test Suite; (inbox unread)"
31 test_begin_subtest "Search: json"
32 output=$(notmuch search --format=json '*' | notmuch_search_sanitize)
33 test_expect_equal_json "$output" '
37 "date_relative": "2001-01-05",
45 "timestamp": 978709437,
47 "query": ["id:notmuch-sha1-7a6e4eac383ef958fcd3ebf2143db71b8ff01161", null]
50 "authors": "Notmuch Test Suite",
51 "date_relative": "1970-01-01",
61 "query": ["id:notmuch-sha1-ca55943aff7a72baf2ab21fa74fab3d632401334", null]
65 test_begin_subtest "Show: text"
66 output=$(notmuch show '*' | notmuch_show_sanitize)
67 test_expect_equal "$output" "\
68 \fmessage{ id:notmuch-sha1-7a6e4eac383ef958fcd3ebf2143db71b8ff01161 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-2
70 (2001-01-05) (inbox unread)
73 To: Notmuch Test Suite <test_suite@notmuchmail.org>
74 Date: Fri, 05 Jan 2001 15:43:57 +0000
77 \fpart{ ID: 1, Content-type: text/plain
82 \fmessage{ id:notmuch-sha1-ca55943aff7a72baf2ab21fa74fab3d632401334 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-1
84 Notmuch Test Suite <test_suite@notmuchmail.org> (1970-01-01) (inbox unread)
86 From: Notmuch Test Suite <test_suite@notmuchmail.org>
87 Date: Thu, 01 Jan 1970 00:00:00 +0000
90 \fpart{ ID: 1, Content-type: text/plain
96 test_begin_subtest "Show: json"
97 output=$(notmuch show --format=json '*' | notmuch_json_show_sanitize)
98 expected=$(notmuch_json_show_sanitize <<EOF
106 "content-type": "text/plain",
111 "date_relative": "2001-01-05",
113 "filename": ["YYYYY"],
115 "Date": "Fri, 05 Jan 2001 15:43:57 +0000",
118 "To": "Notmuch Test Suite <test_suite@notmuchmail.org>"
126 "timestamp": 978709437
137 "content-type": "text/plain",
142 "date_relative": "1970-01-01",
144 "filename": ["YYYYY"],
146 "Date": "Thu, 01 Jan 1970 00:00:00 +0000",
147 "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
164 test_expect_equal_json "$output" "$expected"