2 test_description='messages with missing headers'
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>
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] (null); (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,
49 "authors": "Notmuch Test Suite",
50 "date_relative": "1970-01-01",
63 test_begin_subtest "Show: text"
64 output=$(notmuch show '*' | notmuch_show_sanitize)
65 test_expect_equal "$output" "\
66 \fmessage{ id:notmuch-sha1-7a6e4eac383ef958fcd3ebf2143db71b8ff01161 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-2
68 (2001-01-05) (inbox unread)
71 To: Notmuch Test Suite <test_suite@notmuchmail.org>
72 Date: Fri, 05 Jan 2001 15:43:57 +0000
75 \fpart{ ID: 1, Content-type: text/plain
80 \fmessage{ id:notmuch-sha1-ca55943aff7a72baf2ab21fa74fab3d632401334 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-1
82 Notmuch Test Suite <test_suite@notmuchmail.org> (1970-01-01) (inbox unread)
84 From: Notmuch Test Suite <test_suite@notmuchmail.org>
85 Date: Thu, 01 Jan 1970 00:00:00 +0000
88 \fpart{ ID: 1, Content-type: text/plain
94 test_begin_subtest "Show: json"
95 output=$(notmuch show --format=json '*' | notmuch_json_show_sanitize)
96 test_expect_equal_json "$output" '
104 "content-type": "text/plain",
108 "date_relative": "2001-01-05",
112 "Date": "Fri, 05 Jan 2001 15:43:57 +0000",
115 "To": "Notmuch Test Suite <test_suite@notmuchmail.org>"
123 "timestamp": 978709437
134 "content-type": "text/plain",
138 "date_relative": "1970-01-01",
142 "Date": "Thu, 01 Jan 1970 00:00:00 +0000",
143 "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",