2 test_description="naming of threads with changing subject"
4 test_expect_success 'Generate some messages' '
5 add_message "[subject]=\"thread-naming: Initial thread subject\"" \
6 "[date]=\"Fri, 05 Jan 2001 15:43:56 -0000\"" &&
7 first=${gen_msg_cnt} &&
8 parent=${gen_msg_id} &&
9 add_message "[subject]=\"thread-naming: Older changed subject\"" \
10 "[date]=\"Sat, 06 Jan 2001 15:43:56 -0000\"" \
11 "[in-reply-to]=\<$parent\>" &&
12 add_message "[subject]=\"thread-naming: Newer changed subject\"" \
13 "[date]=\"Sun, 07 Jan 2001 15:43:56 -0000\"" \
14 "[in-reply-to]=\<$parent\>" &&
15 add_message "[subject]=\"thread-naming: Final thread subject\"" \
16 "[date]=\"Mon, 08 Jan 2001 15:43:56 -0000\"" \
17 "[in-reply-to]=\<$parent\>" &&
21 test_expect_success "Initial thread name (oldest-first search)" '
22 output=$($NOTMUCH search --sort=oldest-first thread-naming and tag:inbox | notmuch_search_sanitize) &&
23 pass_if_equal "$output" "thread:XXX 2001-01-05 [4/4] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
26 test_expect_success "Initial thread name (newest-first search)" '
27 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize) &&
28 pass_if_equal "$output" "thread:XXX 2001-01-08 [4/4] Notmuch Test Suite; thread-naming: Final thread subject (inbox unread)"
30 # Remove oldest and newest messages from search results
31 $NOTMUCH tag -inbox id:$parent or id:$final
34 test_expect_success "Changed thread name (oldest-first search)" '
35 output=$($NOTMUCH search --sort=oldest-first thread-naming and tag:inbox | notmuch_search_sanitize) &&
36 pass_if_equal "$output" "thread:XXX 2001-01-06 [2/4] Notmuch Test Suite; thread-naming: Older changed subject (inbox unread)"
39 test_expect_success "Changed thread name (newest-first search)" '
40 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize) &&
41 pass_if_equal "$output" "thread:XXX 2001-01-07 [2/4] Notmuch Test Suite; thread-naming: Newer changed subject (inbox unread)"
44 test_expect_success "Ignore added reply prefix (Re:)" '
45 add_message "[subject]=\"Re: thread-naming: Initial thread subject\"" \
46 "[date]=\"Tue, 09 Jan 2001 15:43:45 -0000\"" \
47 "[in-reply-to]=\<$parent\>" &&
48 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize) &&
49 pass_if_equal "$output" "thread:XXX 2001-01-09 [3/5] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
52 test_expect_success "Ignore added reply prefix (Aw:)" '
53 add_message "[subject]=\"Aw: thread-naming: Initial thread subject\"" \
54 "[date]=\"Wed, 10 Jan 2001 15:43:45 -0000\"" \
55 "[in-reply-to]=\<$parent\>" &&
56 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize) &&
57 pass_if_equal "$output" "thread:XXX 2001-01-10 [4/6] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
60 test_expect_success "Ignore added reply prefix (Vs:)" '
61 add_message "[subject]=\"Vs: thread-naming: Initial thread subject\"" \
62 "[date]=\"Thu, 11 Jan 2001 15:43:45 -0000\"" \
63 "[in-reply-to]=\<$parent\>" &&
64 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize) &&
65 pass_if_equal "$output" "thread:XXX 2001-01-11 [5/7] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
68 test_expect_success "Ignore added reply prefix (Sv:)" '
69 add_message "[subject]=\"Sv: thread-naming: Initial thread subject\"" \
70 "[date]=\"Fri, 12 Jan 2001 15:43:45 -0000\"" \
71 "[in-reply-to]=\<$parent\>" &&
72 output=$($NOTMUCH search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize) &&
73 pass_if_equal "$output" "thread:XXX 2001-01-12 [6/8] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
76 test_expect_success "Test order of messages in \"notmuch show\"" '
77 output=$($NOTMUCH show thread-naming | notmuch_show_sanitize) &&
78 pass_if_equal "$output" "
\fmessage{ id:msg-$(printf "%03d" $first)@notmuch-test-suite depth:0 match:1 filename:/XXX/mail/msg-$(printf "%03d" $first)
80 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (unread)
81 Subject: thread-naming: Initial thread subject
82 From: Notmuch Test Suite <test_suite@notmuchmail.org>
83 To: Notmuch Test Suite <test_suite@notmuchmail.org>
84 Date: Fri, 05 Jan 2001 15:43:56 -0000
87 \fpart{ ID: 1, Content-type: text/plain
88 This is just a test message (#$first)
92 \fmessage{ id:msg-$(printf "%03d" $((first + 1)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 1)))
94 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-06) (inbox unread)
95 Subject: thread-naming: Older changed subject
96 From: Notmuch Test Suite <test_suite@notmuchmail.org>
97 To: Notmuch Test Suite <test_suite@notmuchmail.org>
98 Date: Sat, 06 Jan 2001 15:43:56 -0000
101 \fpart{ ID: 1, Content-type: text/plain
102 This is just a test message (#$((first + 1)))
106 \fmessage{ id:msg-$(printf "%03d" $((first + 2)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 2)))
108 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-07) (inbox unread)
109 Subject: thread-naming: Newer changed subject
110 From: Notmuch Test Suite <test_suite@notmuchmail.org>
111 To: Notmuch Test Suite <test_suite@notmuchmail.org>
112 Date: Sun, 07 Jan 2001 15:43:56 -0000
115 \fpart{ ID: 1, Content-type: text/plain
116 This is just a test message (#$((first + 2)))
120 \fmessage{ id:msg-$(printf "%03d" $((first + 3)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 3)))
122 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-08) (unread)
123 Subject: thread-naming: Final thread subject
124 From: Notmuch Test Suite <test_suite@notmuchmail.org>
125 To: Notmuch Test Suite <test_suite@notmuchmail.org>
126 Date: Mon, 08 Jan 2001 15:43:56 -0000
129 \fpart{ ID: 1, Content-type: text/plain
130 This is just a test message (#$((first + 3)))
134 \fmessage{ id:msg-$(printf "%03d" $((first + 4)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 4)))
136 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-09) (inbox unread)
137 Subject: Re: thread-naming: Initial thread subject
138 From: Notmuch Test Suite <test_suite@notmuchmail.org>
139 To: Notmuch Test Suite <test_suite@notmuchmail.org>
140 Date: Tue, 09 Jan 2001 15:43:45 -0000
143 \fpart{ ID: 1, Content-type: text/plain
144 This is just a test message (#$((first + 4)))
148 \fmessage{ id:msg-$(printf "%03d" $((first + 5)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 5)))
150 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-10) (inbox unread)
151 Subject: Aw: thread-naming: Initial thread subject
152 From: Notmuch Test Suite <test_suite@notmuchmail.org>
153 To: Notmuch Test Suite <test_suite@notmuchmail.org>
154 Date: Wed, 10 Jan 2001 15:43:45 -0000
157 \fpart{ ID: 1, Content-type: text/plain
158 This is just a test message (#$((first + 5)))
162 \fmessage{ id:msg-$(printf "%03d" $((first + 6)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 6)))
164 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-11) (inbox unread)
165 Subject: Vs: thread-naming: Initial thread subject
166 From: Notmuch Test Suite <test_suite@notmuchmail.org>
167 To: Notmuch Test Suite <test_suite@notmuchmail.org>
168 Date: Thu, 11 Jan 2001 15:43:45 -0000
171 \fpart{ ID: 1, Content-type: text/plain
172 This is just a test message (#$((first + 6)))
176 \fmessage{ id:msg-$(printf "%03d" $((first + 7)))@notmuch-test-suite depth:1 match:1 filename:/XXX/mail/msg-$(printf "%03d" $((first + 7)))
178 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-12) (inbox unread)
179 Subject: Sv: thread-naming: Initial thread subject
180 From: Notmuch Test Suite <test_suite@notmuchmail.org>
181 To: Notmuch Test Suite <test_suite@notmuchmail.org>
182 Date: Fri, 12 Jan 2001 15:43:45 -0000
185 \fpart{ ID: 1, Content-type: text/plain
186 This is just a test message (#$((first + 7)))