2 test_description="naming of threads with changing subject"
3 . $(dirname "$0")/test-lib.sh || exit 1
5 test_begin_subtest "Initial thread name (oldest-first search)"
6 add_message '[subject]="thread-naming: Initial thread subject"' \
7 '[date]="Fri, 05 Jan 2001 15:43:56 -0000"'
10 add_message '[subject]="thread-naming: Older changed subject"' \
11 '[date]="Sat, 06 Jan 2001 15:43:56 -0000"' \
12 "[in-reply-to]=\<$parent\>"
13 add_message '[subject]="thread-naming: Newer changed subject"' \
14 '[date]="Sun, 07 Jan 2001 15:43:56 -0000"' \
15 "[in-reply-to]=\<$parent\>"
16 add_message '[subject]="thread-naming: Final thread subject"' \
17 '[date]="Mon, 08 Jan 2001 15:43:56 -0000"' \
18 "[in-reply-to]=\<$parent\>"
20 output=$(notmuch search --sort=oldest-first thread-naming and tag:inbox | notmuch_search_sanitize)
21 test_expect_equal "$output" "thread:XXX 2001-01-05 [4/4] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
23 test_begin_subtest "Initial thread name (newest-first search)"
24 output=$(notmuch search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
25 test_expect_equal "$output" "thread:XXX 2001-01-08 [4/4] Notmuch Test Suite; thread-naming: Final thread subject (inbox unread)"
27 # Remove oldest and newest messages from search results
28 notmuch tag -inbox id:$parent or id:$final
30 test_begin_subtest "Changed thread name (oldest-first search)"
31 output=$(notmuch search --sort=oldest-first thread-naming and tag:inbox | notmuch_search_sanitize)
32 test_expect_equal "$output" "thread:XXX 2001-01-06 [2/4] Notmuch Test Suite; thread-naming: Older changed subject (inbox unread)"
34 test_begin_subtest "Changed thread name (newest-first search)"
35 output=$(notmuch search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
36 test_expect_equal "$output" "thread:XXX 2001-01-07 [2/4] Notmuch Test Suite; thread-naming: Newer changed subject (inbox unread)"
38 test_begin_subtest "Ignore added reply prefix (Re:)"
39 add_message '[subject]="Re: thread-naming: Initial thread subject"' \
40 '[date]="Tue, 09 Jan 2001 15:43:45 -0000"' \
41 "[in-reply-to]=\<$parent\>"
42 output=$(notmuch search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
43 test_expect_equal "$output" "thread:XXX 2001-01-09 [3/5] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
45 test_begin_subtest "Ignore added reply prefix (Aw:)"
46 add_message '[subject]="Aw: thread-naming: Initial thread subject"' \
47 '[date]="Wed, 10 Jan 2001 15:43:45 -0000"' \
48 "[in-reply-to]=\<$parent\>"
49 output=$(notmuch search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
50 test_expect_equal "$output" "thread:XXX 2001-01-10 [4/6] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
52 test_begin_subtest "Ignore added reply prefix (Vs:)"
53 add_message '[subject]="Vs: thread-naming: Initial thread subject"' \
54 '[date]="Thu, 11 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 test_expect_equal "$output" "thread:XXX 2001-01-11 [5/7] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
59 test_begin_subtest "Ignore added reply prefix (Sv:)"
60 add_message '[subject]="Sv: thread-naming: Initial thread subject"' \
61 '[date]="Fri, 12 Jan 2001 15:43:45 -0000"' \
62 "[in-reply-to]=\<$parent\>"
63 output=$(notmuch search --sort=newest-first thread-naming and tag:inbox | notmuch_search_sanitize)
64 test_expect_equal "$output" "thread:XXX 2001-01-12 [6/8] Notmuch Test Suite; thread-naming: Initial thread subject (inbox unread)"
66 test_begin_subtest "Use empty subjects if necessary."
67 add_message '[subject]="@FORCE_EMPTY"' \
68 '[date]="Sat, 13 Jan 2001 15:43:45 -0000"' \
69 '[from]="Empty Sender <empty_test@notmuchmail.org>"'
70 empty_parent=${gen_msg_id}
71 add_message '[subject]="@FORCE_EMPTY"' \
72 '[date]="Sun, 14 Jan 2001 15:43:45 -0000"' \
73 '[from]="Empty Sender <empty_test@notmuchmail.org>"' \
74 "[in-reply-to]=\<$empty_parent\>"
75 output=$(notmuch search --sort=newest-first from:empty_test@notmuchmail.org | notmuch_search_sanitize)
76 test_expect_equal "$output" "thread:XXX 2001-01-14 [2/2] Empty Sender; (inbox unread)"
78 test_begin_subtest "Avoid empty subjects if possible (newest-first)."
79 add_message '[subject]="Non-empty subject (1)"' \
80 '[date]="Mon, 15 Jan 2001 15:43:45 -0000"' \
81 '[from]="Empty Sender <empty_test@notmuchmail.org>"' \
82 "[in-reply-to]=\<$empty_parent\>"
83 add_message '[subject]="Non-empty subject (2)"' \
84 '[date]="Mon, 16 Jan 2001 15:43:45 -0000"' \
85 '[from]="Empty Sender <empty_test@notmuchmail.org>"' \
86 "[in-reply-to]=\<$empty_parent\>"
87 add_message '[subject]="@FORCE_EMPTY"' \
88 '[date]="Tue, 17 Jan 2001 15:43:45 -0000"' \
89 '[from]="Empty Sender <empty_test@notmuchmail.org>"' \
90 "[in-reply-to]=\<$empty_parent\>"
91 output=$(notmuch search --sort=newest-first from:Empty | notmuch_search_sanitize)
92 test_expect_equal "$output" "thread:XXX 2001-01-17 [5/5] Empty Sender; Non-empty subject (2) (inbox unread)"
94 test_begin_subtest "Avoid empty subjects if possible (oldest-first)."
95 output=$(notmuch search --sort=oldest-first from:Empty | notmuch_search_sanitize)
96 test_expect_equal "$output" "thread:XXX 2001-01-13 [5/5] Empty Sender; Non-empty subject (1) (inbox unread)"
98 test_begin_subtest 'Test order of messages in "notmuch show"'
99 output=$(notmuch show thread-naming | notmuch_show_sanitize)
100 test_expect_equal "$output" "
\fmessage{ id:msg-$(printf "%03d" $first)@notmuch-test-suite depth:0 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $first)
102 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (unread)
103 Subject: thread-naming: Initial thread subject
104 From: Notmuch Test Suite <test_suite@notmuchmail.org>
105 To: Notmuch Test Suite <test_suite@notmuchmail.org>
106 Date: Fri, 05 Jan 2001 15:43:56 +0000
109 \fpart{ ID: 1, Content-type: text/plain
110 This is just a test message (#$first)
114 \fmessage{ id:msg-$(printf "%03d" $((first + 1)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 1)))
116 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-06) (inbox unread)
117 Subject: thread-naming: Older changed subject
118 From: Notmuch Test Suite <test_suite@notmuchmail.org>
119 To: Notmuch Test Suite <test_suite@notmuchmail.org>
120 Date: Sat, 06 Jan 2001 15:43:56 +0000
123 \fpart{ ID: 1, Content-type: text/plain
124 This is just a test message (#$((first + 1)))
128 \fmessage{ id:msg-$(printf "%03d" $((first + 2)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 2)))
130 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-07) (inbox unread)
131 Subject: thread-naming: Newer changed subject
132 From: Notmuch Test Suite <test_suite@notmuchmail.org>
133 To: Notmuch Test Suite <test_suite@notmuchmail.org>
134 Date: Sun, 07 Jan 2001 15:43:56 +0000
137 \fpart{ ID: 1, Content-type: text/plain
138 This is just a test message (#$((first + 2)))
142 \fmessage{ id:msg-$(printf "%03d" $((first + 3)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 3)))
144 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-08) (unread)
145 Subject: thread-naming: Final thread subject
146 From: Notmuch Test Suite <test_suite@notmuchmail.org>
147 To: Notmuch Test Suite <test_suite@notmuchmail.org>
148 Date: Mon, 08 Jan 2001 15:43:56 +0000
151 \fpart{ ID: 1, Content-type: text/plain
152 This is just a test message (#$((first + 3)))
156 \fmessage{ id:msg-$(printf "%03d" $((first + 4)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 4)))
158 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-09) (inbox unread)
159 Subject: Re: thread-naming: Initial thread subject
160 From: Notmuch Test Suite <test_suite@notmuchmail.org>
161 To: Notmuch Test Suite <test_suite@notmuchmail.org>
162 Date: Tue, 09 Jan 2001 15:43:45 +0000
165 \fpart{ ID: 1, Content-type: text/plain
166 This is just a test message (#$((first + 4)))
170 \fmessage{ id:msg-$(printf "%03d" $((first + 5)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 5)))
172 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-10) (inbox unread)
173 Subject: Aw: thread-naming: Initial thread subject
174 From: Notmuch Test Suite <test_suite@notmuchmail.org>
175 To: Notmuch Test Suite <test_suite@notmuchmail.org>
176 Date: Wed, 10 Jan 2001 15:43:45 +0000
179 \fpart{ ID: 1, Content-type: text/plain
180 This is just a test message (#$((first + 5)))
184 \fmessage{ id:msg-$(printf "%03d" $((first + 6)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 6)))
186 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-11) (inbox unread)
187 Subject: Vs: thread-naming: Initial thread subject
188 From: Notmuch Test Suite <test_suite@notmuchmail.org>
189 To: Notmuch Test Suite <test_suite@notmuchmail.org>
190 Date: Thu, 11 Jan 2001 15:43:45 +0000
193 \fpart{ ID: 1, Content-type: text/plain
194 This is just a test message (#$((first + 6)))
198 \fmessage{ id:msg-$(printf "%03d" $((first + 7)))@notmuch-test-suite depth:1 match:1 excluded:0 filename:/XXX/mail/msg-$(printf "%03d" $((first + 7)))
200 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-12) (inbox unread)
201 Subject: Sv: thread-naming: Initial thread subject
202 From: Notmuch Test Suite <test_suite@notmuchmail.org>
203 To: Notmuch Test Suite <test_suite@notmuchmail.org>
204 Date: Fri, 12 Jan 2001 15:43:45 +0000
207 \fpart{ ID: 1, Content-type: text/plain
208 This is just a test message (#$((first + 7)))